1 2 Previous Next 17 Replies Latest reply on May 13, 2014 8:47 AM by philmodjunk

    PDF to single pages



      PDF to single pages


           Hello, I'm Back with new problem :(


           I have a layout: two pages A4 for each person and 178 persons in one group. 

           When I'm doing "Save/Send Records As --> PDF" I get one PDF with 356 pages, for all persons.


           Can I get 178 PDFs, each for only one person?

        • 1. Re: PDF to single pages

               Use a looping script that loops through your records.

               Use Save As PDF with the current record option inside this loop to save one PDF for each record in your current found set.

          • 2. Re: PDF to single pages

                 More details, please. 

                 Loop explanation in filemaker isn't very clear.

            • 3. Re: PDF to single pages

                   Create a script:

                   Go to record/request/page [First]
                       Set Variable [$Path ; value: //put a calculation here that specifies both a location where you want to save the PDF and a file name unique for each record. Use this variable with Save As PDF to specify where to save each PDF and what to name it. ]

                      Save As Pdf [....  (there's an option with this script step for specifying "Current Record")
                       Go to record/request/page [next ; exit after last ]
                   End Loop

                   This script will save one PDF for every record in your current found set. You may want to perform a find or use Go To Related Records as the first step of this script to pull up the group of records for which you want to save the individual PDFs.

              • 4. Re: PDF to single pages

                     This "Set variable" step is a mistery... Could You explain it even more, please?

                     I did it like it is above but it doesn't puts file name automaticly. I have to put a name for each saved file manually.


                     What went wrong?

                • 5. Re: PDF to single pages

                       Because I do not know the details of your database design, I've only posted a general outline of what must be done to get this to work.

                       This thread has more info on how to use Save As PDF with a $Path variable in a script: Found Sets to PDF with unique file names

                       This thread has more info on $Path variables and the script steps that can use a a$Path variable: Exploring the use of a $Path Variable in Scripts

                  • 6. Re: PDF to single pages

                    I don't understand this "variables". With "Set variable" I have few options. Could You explain them?


                    Name: what should be here? What is $ for?

                    Value: I choose a Field with "PersonName" as a name for a file, right? But it doesnt works. 

                    Repetition: 1 (what is this for)?


                         More I work with FMPro 13 - more I feel like a total begginer. 

                    • 7. Re: PDF to single pages

                           A variable is like a temporary field for storing data that is not part of any given record. A variable named with a single $ such as $Path will exist only as long as the script that created it is running. A variable that starts with two $$ is called a global variable and it will remain until you close the file. Such a global variable is not needed here.

                           You cannot choose just a file name for the $Path variable. This is a file path (as explained and demonstrated in the two links that I provided), that specifies both the name of the file and the location where the file will be stored when it is created.  The Save As PDF step needs that info in order to save the PDF without stopping and asking the user to specify a name and location for each PDF.

                           Repetitions can be specified for repeating variables just like you can a repeating field. This is not needed here so just leave the repetition specified as "1".


                                More I work with FMPro 13 - more I feel like a total begginer.

                           Well none of this is unique to FileMaker 13. If I were to do this in FileMaker 10, the script would be the same.wink

                           Please review the examples in the two thread to which I provided links in an earlier post.

                      • 8. Re: PDF to single pages

                             I read all this stuff, but it is very complicated...

                             My script doesn't work. I run it and I have a window "Save record as PDF" with "save as untitled". When I write name, it goes to the next record, but names aren't given automaticly.

                             I don't know what is wrong.

                        • 9. Re: PDF to single pages

                               And there is no way that I can tell, precisely what is wrong just from such a general description that says little more than "it didn't work". I suggest posting your current version of this script so that I can see what is not set up correctly.

                               To post a script to the forum:

                          1.           You can upload a screen shot of your script by using the Upload an Image controls located just below Post a New Answer.
                          3.           You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
                          5.           If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
                          7.           If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
                          • 10. Re: PDF to single pages

                                  Enter Browse Mode

                            Go to Layout [ “Dane osobowe - formularz” (Person) ]

                            Perform Find [ Specified Find Requests: Find Records; Criteria: Person::Przynależność: “="Gdańska"” AND Person::Data śmierci: “=” AND Person::Opuścił dnia: “=” ]
                            Restore ]

                            Sort Records by Field [ Ascending; Person::Nazwisko ] Go to Record/Request/Page

                            [ First ] Loop

                            Set Variable [ $Path; Value:"file:/Users/lesluc/Desktop/Dane personalne/Person::_ID person.pdf" ]

                            Save Records as PDF [ Current record ]
                            Document - Title: Person::_ID person; Compatibility: Acrobat 7 and later ]
                            Pages - Number Pages From: 1; Include: All pages ]
                            Security - Printing: High Resolution; Editing: Any except extracting pages; Enable copying; Enable Screen Reader ] [ Initial View - Show: Pages Panel and Page; Page Layout: Single Page; Magnification: 100% ]

                            [ Restore; No dialog ]
                            Go to Record/Request/Page

                            [ Next; Exit after last ] End Loop 


                            • 11. Re: PDF to single pages

                              Go to Layout[“Dane osobowe - formularz” (Person)]

                              Perform Find[ Specified Find Requests:Find Records; Criteria: Person::Przynależność: “="Gdańska"” ANDPerson::Dataśmierci: “=” AND Person::Opuścił dnia: “=”]

                              Sort Records by Field[Ascending;Person::Nazwisko ]Go to Record/Request/Page[First]


                                 Set Variable[$Path; Value:"file:/Users/lesluc/Desktop/Dane personalne/Person::_ID person.pdf"]

                                 Save Records as PDF[Current record]
                              Document -Title:Person::_ID person; Compatibility:Acrobat 7 and later ]
                              Pages -Number Pages From:1; Include:All pages ]
                              Security -Printing:High Resolution; Editing:Any except extracting pages;Enable copying;Enable Screen Reader ] [Initial View -Show:Pages Panel and Page;
                                                     Page Layout:
                              Single Page; Magnification:100%] [Restore; No dialog]
                                                     Go to Record/Request/Page
                              [Next; Exit after last]

                              End Loop

                                                  What appears to be missing from your script is that your Save As PDF script step does not actually use the $Path variable created in the step just before it. Save AS PDF is supposed to use the text in $Path to determine where to store the new PDF file and what to name it.

                                                  Click the Save Records as PDF script step in your script to select it. Click the Specify... button for "Specify output file". Type in the exact name of your variable, $Path. Do not use quotes.


                              • 12. Re: PDF to single pages

                                Set Variable [ $Path; Value:"file:/Users/lesluc/Desktop/Dane personalne/Person::_ID person.pdf" ]

                                     This construction is wrong. It should be like this:

                                Set Variable [ $Path; Value:"file:/Users/lesluc/Desktop/Dane personalne/" & Person::_ID person & ".pdf" ]

                                          Do you have FMPro Advanced? Then use the debugging tools.
                                          Don't you have FMPro Advanced? Then purchase it. Life will be better.


                                • 13. Re: PDF to single pages

                                       Even better:

                                       Get ( DesktopPath ) & "Dane personalne/" & Person::_ID Person & ".pdf"

                                       Get ( DesktopPath) returns the file path to the current user's desktop folder in valid format for either Mac or windows.

                                  • 14. Re: PDF to single pages



                                         Thank you very much, both of you! Everything is ok now! You saved me a lot of time.

                                         With specialists like you FM Advanced isn't necessary :)


                                         See You soon!

                                    1 2 Previous Next