7 Replies Latest reply on Nov 12, 2008 9:04 AM by Orlando

    Printer Page Orientation



      Printer Page Orientation




      I have to print a series of reports, in a specific order, and the orientation (landscape versus portrait) changes from report to report. 


      How can I set the printer page orientation in a script?


      Thank you 

        • 1. Re: Printer Page Orientation

          Hi DrDave,


          You can change the orientation of a page using the 'Print Setup' script step each time within you report print script.


          Or instead of setting the print setup for each change you could create a new script that sets both orientations and call it as a subscript each time using a parameter to determine the orientation that is set.


          The script would look like this:


          Script Name: PrintSetup



           If [ Get ( ScriptParameter ) = "Portrait" ) ] 

           # Set page to portrait

           Print Setup [Restore ; No Dialog]

           Else if [ Get ( ScriptParameter ) = "Landscape" ) ] 

           # Set page to landscape

           Print Setup [Restore ; No Dialog]

           End if



          Then when you call the script, use the 'Perform Script' step and set the Optional Script Parameter to be the Orientation you require, i.e.



           Perform Script ["PrintSetup"; Parameter: "Landscape"



          I hope this does the trick.



          • 2. Re: Printer Page Orientation

            This looks to be exactly what I want. Thank you. 


            More specifically, can I setup this function "somewhere" and then use the function call in a number of my scripts, or do I have to include the function in all the scripts where I use it? I doubt if this is true, but I'm new to FM and don't know where to store what I would call Global Functions.



            • 3. Re: Printer Page Orientation

              Yes you can, effectively what you are creating here is a standalone script, PrintScript, that you can call from any other script as a subscript simply using the Perform Script step, as long as you specify the orientation in the Parameter as below it will do this for you.



               Perform Script ["PrintSetup"; Parameter: "Landscape" ]



              Let me know if your unsure about anything. 

              • 4. Re: Printer Page Orientation

                I have a Competitor database and I setup a script called dhPrinterSetup. I have a Monochrome database and I imbedded the script call into my report. Here is the function code.




                Since I don't know how to use the debugger yet, I simply put the "show custom dialogue in each condition.


                When I call the function, I do get into the proper "else if." However, assume that I manually set my orientation to portrait; I then call the function with Landscape. When I check my printer setup, it's still on portrait.


                When I added the "print setup" code I made sure to select portrait and landscape properly.


                Any ideas? 

                • 5. Re: Printer Page Orientation

                  Is the dhPrinterSetup script in the same database file, or are you calling it from another file?


                  If you are calling it from another file then the file the dhPrinterSetup script is in will have its orientation changed, not the file you are calling it from.


                  If this is the case simply copy the script dhPrinterSetup and paste into each file you need it in.


                  This is the only reason I can think that this would happen. 

                  • 6. Re: Printer Page Orientation

                    I had the function in another database and you were right, as soon as I copied it, it worked. It seems that each database retains it's own printer setup settings.


                    It's a pity that I need to have six copies of the same function.


                    Thank you for your help.


                    Dr Dave 

                    • 7. Re: Printer Page Orientation
                         No worries Dr Dave, glad to help.