4 Replies Latest reply on Nov 4, 2014 3:24 AM by monkeybreadsoftware

    Adding a 1 page form to existing PDF...

    alinicjones

      I have an existing PDF in a container field (the PDF is around 25-30 pages long), I would like to add a cover page to the existing PDF using a button. The cover page is a generated report based off of a layout. Ideally I would like it to open in Adobe or in Preview Mode so the user can decied if they want to email this complete report or save it to their desktop.

       

      Right now i have a script that opens up the the cover page. Can't seem to firgure out where to go from here and everything i have seen on here doesn't seem to work.

       

      Print Applicant Summary Sheet Calc.png

        • 1. Re: Adding a 1 page form to existing PDF...
          wsvp

          I know of no way to add the page to a file in a container field.  You can write out a PDF file to disk, then use the append PDF option (this will require setting up paths)... I am not sure if this option will allow the option of setting it as the front page (I doubt it)... Also Append PDF has a reputation for being extremely slow.  I think it would probably be best to set the layout up so the choice of the cover page is included when the original is output, or output a whole new PDF.

           

          There may also be a plugin available that could accomplish this.

           

          As an "alternate" consideration, the HTML5 format allows for data to be written out to disk as an HTML (text) file which can be opened up in any HTML5 browser.  It also is not restricted in the Runtime version licensing like PDF export is. This (in my humble opinion) "is" the future. though It does require "quite a bit" of learning, and involves setting up a calculation or script that builds the HTML data in a field or variable.

          • 2. Re: Adding a 1 page form to existing PDF...
            keywords

            You can save the coversheet record as a pdf using something like:

             

            Set Variable [ $filepath; Value:Get ( TemporaryPath ) & <table::field1> & " " & <table::field2> & ".pdf" ] // define the path ( if you don't wish to use Get ( TemporaryPath ), then whatever path you wish to define ) + whatever naming you wish to use for the file + file extension

            Save Records as PDF [ File Name: “$filepath”; Current record ] // use the variable you just defined

            Those steps will give you a pdf of your cover page. If you had previously exported the existing container field to this location AND you set the variable above as the same name as the exported file, you could use the append to existing PDF option (see screenshot) to attach your cover page—BUT as far I can tell this will add the cover page at the end of the document, whereas no doubt you want it at the start (not sure how to accomplish that from within FM). The pdf, complete with its new page, can then be resaved to the container field. All of that could be done within a single script.

             

            Screen Shot 2014-11-04 at 9.20.38 am.png

            • 3. Re: Adding a 1 page form to existing PDF...
              PalmDBS

              What platform are your users on?

              • 4. Re: Adding a 1 page form to existing PDF...
                monkeybreadsoftware

                As an alternative you could use a plugin to combine PDFs.

                e.g. with MBS Plugin via PDFKit or DynaPDF.

                http://www.monkeybreadsoftware.de/filemaker/