7 Replies Latest reply on Aug 8, 2017 10:36 AM by monkeybreadsoftware

    Print Multiple Layouts to a single PDF

    jdsturgeon52

      I have 3 different layouts that I want to create a single pdf.  Does anyone have a script example that I might be able to adapt?

      Thanks

        • 1. Re: Print Multiple Layouts to a single PDF
          steveromig

          I have 3 different layouts that I want to create a single pdf. Does anyone have a script example that I might be able to adapt?

          Thanks

          One approach is to use the Save Records as PDF script step and use the "Append to existing PDF" option.  Something along the lines of...

           

          Go to Layout [Layout 1]

          Save Records as PDF [Restore; With dialog:Off; NameOfPDF.pdf"; Records being browsed]

          Go to Layout [Layout 2]

          Save Records as PDF [Restore; Append; With dialog:Off; NameOfPDF.pdf"; Records being browsed]

          Go to Layout [Layout 3]

          Save Records as PDF [Restore; Append; With dialog:Off; NameOfPDF.pdf"; Records being browsed]

           

          Basically it goes to Layout 1, saves your records to a PDF that is created using this step, and then goes to Layout 2 and Layout 3 and adds to the PDF created in the first Save Records as PDF call.

           

          Steve Romig

          FileMaker, Inc.

          • 2. Re: Print Multiple Layouts to a single PDF
            jdsturgeon52

            Steve,

            Thanks I'll try this..

            Let you know how it works..

            John

            • 3. Re: Print Multiple Layouts to a single PDF
              jdsturgeon52

              Steve,

              I tried it and it worked to a point.  It makes you append (save each pdf layout) as another file.  So it goes through the script fine but still produces 3 individual files.

               

              I'll keep working on it there must be a way.  I've been able to print in that sequence but I'm going to try on the "Dialog" options at each print point to save it as a pdf. 

               

              I'll let you know

              Thx

              J

              • 4. Re: Print Multiple Layouts to a single PDF
                steveromig

                John Sturgeon wrote:

                 

                Steve,

                I tried it and it worked to a point. It makes you append (save each pdf layout) as another file. So it goes through the script fine but still produces 3 individual files.

                 

                I'll keep working on it there must be a way. I've been able to print in that sequence but I'm going to try on the "Dialog" options at each print point to save it as a pdf.

                 

                I'll let you know

                Thx

                J

                 

                In the first "Save As..." step you should specify the file you want to save to.  As long as you specify the same file for the other two "Save As..." steps it will only create one file. 

                 

                The easiest thing to do would be to create the first "Save As..." script step and then duplicate it twice...adding the "Append" option to the 2nd and 3rd one.  The Append option is the key.

                 

                Steve Romig

                FileMaker, Inc.

                • 5. Re: Print Multiple Layouts to a single PDF
                  keywords

                  Steve's script is basically right, but you need to set the filepath as a variable before the Save steps. In a similar script I use a Let ( ) statement to generate the variable $filepath, which you then use as the Output File Path.

                  Screen Shot 2017-08-08 at 6.46.13 AM.png

                  The calc that is generated by your variable needs to match the specs shown at the bottom of this dialog window—so must include a specified file path as well as the name you wish to give the file itself. If you want the resulting pdf to be retained outside of FM, then the path you specify must enable that (perhaps using Get (DesktopPath ) or Get ( DocumentsPath ) together with actual file naming), but if you only want to generate the pdf and then, say, store it in a container inside FM, or email it and then dump it, then you can use Get ( TemporaryPath ). If you use the last, FM generates its own storage path and then dumps it at the end of your FM session.

                  • 6. Re: Print Multiple Layouts to a single PDF
                    jdsturgeon52

                    Many thanks.  Before I received your message I made an Automator script to combine the pdf in a folder.  I had looked on the web and there were some references (as well as in FM) that talked about making the $filepath variable.  Also in the options when setting the various script steps there are again references to sending to a file path location.  I will try this and see how this works.  The other reference I found was with "Ghost Script".  However I've not done that and just tried to get the automator to work.  It did do it once, but something in my workflow is causing me an issue.  I know the automator would work if someone has a Mac, however I'm not sure there is a clean way to do the same on the Windows platform.

                    Thanks for the helpful info...

                    • 7. Re: Print Multiple Layouts to a single PDF
                      monkeybreadsoftware

                      If you just let FileMaker make the various PDFs, you can use MBS FileMaker Plugin to merge them.

                      e.g. on Mac with PDFKit.

                       

                      Or use our DynaPDF functions to merge and than you can also use optimize command to shrink overall size.