2 Replies Latest reply on Jul 27, 2015 10:36 AM by derlandson

    Save as pdf from Preview

    derlandson

      Having trouble with a script that is supposed to make multiple pdfs from a set of found records.  The records are viewed in a layout that can show a preview of the pdf, however the pdf has a header in the layout that gathers the appropriate records based on a sub-summary related to an ID number.  In the save as pdf script step the only choices are to save records being browsed, current record or blank record.  When I run the script with one ID number the pdf (sometimes multiple pages) is generated fine.  The problem is when there is a group of individuals and there should be multiple pdf's generated based on different IDs.  I either get one big pdf with all info in it (records being browsed) or a truncated pdf with not enough info in it (current record).  What am I missing here??  Do I really need to view these records one at a time and save the pdf for each?  Guess I am looking for a way to loop through these records and save each appropriate one (based on ID) as a pdf.

       

      Hope this is clear.

       

      dan

        • 1. Re: Save as pdf from Preview
          erolst

          derlandson wrote:

          Guess I am looking for a way to loop through these records and save each appropriate one (based on ID) as a pdf.

           

          One way to do that:

           

          Create a summary field as Count of primaryKey, and write a script like

           

          # [ find your records ]

          # [ sort by sub-summary break field ]

          Go to Record/Request [ first ]

          Loop

            Set Variable [

              $nextGroupAt ;

              Get ( RecordNumber ) +

              GetSummary ( sCountOfPrimaryKey ; subSummaryBreakField )

            ]

            New Window

            Find Matching Records [ subSummaryBreakField ; Replace ]

            Save Records as PDF [ … ]

            Close Window

            Exit Loop if [ $nextGroupAt > Get ( FoundCount ]

          Go to Record/Request [ no dialog ; by calculation: $nextGroupAt ]

          End Loop

          • 2. Re: Save as pdf from Preview
            derlandson

            Perfect solution!  Thanks!

             

            dan