6 Replies Latest reply on Mar 21, 2007 1:45 AM by Dave.Hollings

    Printing

    Dave.Hollings Level 1
      I was hope someone will be able to help. I have managed to get the print class to print a MC and all is working well. However it could be better by printing in landscape instead of the default portrait. Is there any ActionScript that can be used to set the orientation of the system printer? I have attach my code just in case there is any questions on what AS I have.

      Any help would be greatly appreciated.
        • 1. Re: Printing
          Level 7
          Dave.Hollings,

          > I was hope someone will be able to help. I have managed to
          > get the print class to print a MC and all is working well. However
          > it could be better by printing in landscape instead of the default
          > portrait. Is there any ActionScript that can be used to set the
          > orientation of the system printer?

          Check out the PrintJob.orientation property under the Property Summary
          of the "PrintJob class" entry in the ActionScript 2.0 Language Reference.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: Printing
            Dave.Hollings Level 1
            David,

            Many thanks for the reply, I haved looked into this however I can't seem to get Flash to set the print orientation. The property seems to only get the information from the system not set it. The example I have studied was using this property to find out what the print orientation was set to by the system and then based on the orientation change the print area. Do you know of a way to actually set it using Flash AS?
            • 3. Re: Printing
              Level 7
              Dave,

              > Many thanks for the reply, I haved looked into this however I
              > can't seem to get Flash to set the print orientation.

              Woops, my apologies. I honestly think I absentmindedly sent my earlier
              reply before I finished it.

              > The property seems to only get the information from the system
              > not set it.

              That's right, which means you can use that information to rotate the
              desired movie clip as necessary. That's the part I failed to mention.

              > The example I have studied was using this property to find out
              > what the print orientation was set to by the system and then
              > based on the orientation change the print area. Do you know
              > of a way to actually set it using Flash AS?

              The PrintJob class prints movie clip instances. The main timeline
              happens to be a movie clip instance, so you can even rotate that, if need
              be. As far as I know, the way to accommodate print orientation Flash is to
              rotate into position, then rotate it back when you're done. This can be
              accomplished via the MovieClip._rotation property, even on the main timeline
              ...

              e.g.
              this._rotation = -90;

              ... rotates the main timeline (assuming "this" is scoped to the main
              timeline; that is, assuming the above code exists in a main timeline
              keyframe). Note, however, that rotation isn't enough. Rotating something
              from its upper left corner actually moves it. In the case of rotating the
              main timeline, it rotates out of view of the visible stage, so you'll want
              to change the _x and _y positions, too, to compensate. It's easier to
              visualize if you experiment with a smaller movie clip first (one whose
              registration point is in the upper left).

              Basically, give your movie clip an instance name, which allows it to be
              "spoken to" by ActionScript, then tell it what to do ...

              myClip._x += 100;
              myClip._y += 100;
              myClip._rotation = -90;
              // etc.


              David Stiller
              Adobe Community Expert
              Dev blog, http://www.quip.net/blog/
              "Luck is the residue of good design."


              • 4. Re: Printing
                Dave.Hollings Level 1
                David,

                Once again thank you for your response. I have been looking into this also and have managed to print successfully in the correct orientation using the ._rotation property. All is working quite well now. The only other question I do have is can the printJob method be used if you have dynamic text fields. I have two within the mc, one will take the values assigned to the following variables: (see complete code for the printscreen frame attached:

                _global.titlecb
                _global.fname
                _global.surname

                The user at the start of my application inputs these values. As they progress and select different options the values are stored within other _global variables. Once they get to the last frame section labelled 'printscreen' there are a few if statements to populate the second dynamic text field.

                In testing when I print, everything prints OK apart from the text within these two areas. On screen within the flash player they are populated with the correct text.

                Any ideas?
                • 5. Re: Printing
                  Level 7
                  Dave,

                  > The only other question I do have is can the printJob
                  > method be used if you have dynamic text fields.

                  Yes, but there's a catch with text fields.

                  > In testing when I print, everything prints OK apart
                  > from the text within these two areas. On screen within
                  > the flash player they are populated with the correct text.

                  Dynamic text fields (input type or not) do not embed character outlines
                  by default. Static text fields do, which is why you can rotate them without
                  losing their content. The reason your text seems to disappear is becasue --
                  this is my hunch, anyway -- the font outlines haven't been embedded.


                  David Stiller
                  Adobe Community Expert
                  Dev blog, http://www.quip.net/blog/
                  "Luck is the residue of good design."


                  • 6. Re: Printing
                    Dave.Hollings Level 1
                    David,

                    Many thanks for all you help with this I do appreciate it. With your explanation (which I have noticed is always detailed and very helpful) I have managed to embed the dynamic text outlines and the print function now works fully. My project is now complete and I can get approval from my managers.

                    Once again many thanks, you are an asset and a wealth of knowledge on this forum.