6 Replies Latest reply on Jun 29, 2011 10:41 AM by Andrew Tillinghast

    Merge data and flaten a PDF form.

    ilssac Level 5

      I am working for the first time on using ColdFusion to populate PDF forms.

       

      I have a simple PDF form I created with my Acrobat 9 Pro tool.  Using the following code, pretty much straight from the documentation, I can easily populate the fields in the PDF with data and save a new PDF file with that data.

       

      <cfpdfform 
          source="#getDirectoryFromPath(getCurrentTemplatePath())#QP-ExpiringLetter.pdf"
          destination="#getDirectoryFromPath(getCurrentTemplatePath())#test.pdf"
          action="populate">
          <cfpdfformparam name="bus_name" value="123 PEST CONTROL">
          <cfpdfformparam name="bus_address" value="1234 MAIN STREET">
          <cfpdfformparam name="bus_city_state_zip" value="HOMETOWN, CA  98765">
      </cfpdfform>
      

       

      But the file is still a "Form" file with the fields editable.  I do not want this.  I want a static PDF file with the fields filled in with the data I provided.  Looking at the documentation, it seems the <CFPDF...> tag has functionality to flatten such form files and do what I want.  What I can not find documentation for, or guess at, is HOW to combine these two tags.  I know I could work with a PDF variable in the <CFPDF...> tag, but I see no way to capture the output of the <CFPDFFORM...> tag into such a variable, I can only send the output to the browser or a file.

       

      Is that the only way to do this?  Send the output to a file, then read that file with the <CFPDF...> tag to flatten it to another file?  That seems a bit IO overhead heavy for what I feel should be able to be done in memory with just one file write.

       

      TIA

      Ian