2 Replies Latest reply on Aug 4, 2008 8:32 AM by darbus23


    Toadsteraz Level 1
      I am having trouble converting a form to pdf. I want the user to fill out a form and when they hit submit, I want it to be converted to a pdf and saved to my server. I will then email the pdf to an email address. I know that the cfdocument will convert it but not sure how to get it to work with the form. When I include it in the form it automatically converts the form without letting the user enter information into the form.

      I just want the user to enter the information and convert that form (like a screen shot) into a pdf. I'm sure it's easy but I'm lost with this new CF8 feature. Please help...

      what I have sorta setup is below.....

        • 1. Re: CFFORM TO PDF
          Ted Daniels
          You can either save data to DBase and read back or populate direct.

          Design a PDF form with fields using Adobe Acrobat professional, assign names to all fields, then populate same from CF as follows:
          DO YOUR DATABASE QUERY. Make sure you are careful to follow field defenition and variable tags << /V(Variable) /T(Field Name) >>

          This provides very robust method for populating fields in PDF form. If it hangs just remove the <CFSETTING> and <CFCONTENT> lines to check if CF is throwing an error, as PDF will just hang.

          Ted Daniels

          <CFSETTING enablecfoutputonly="Yes" showdebugoutput="yes">
          <CFCONTENT Type="application/vnd.fdf">
          1 0 obj
          << /V (<CFIF #GetAccident.Fatal# is 1>x</CFIF>)/T (Fatal)>>
          << /V (<CFIF #GetAccident.CMV# is 1>x</CFIF>)/T (CMV)>>
          << /V (<CFIF #GetAccident.SchoolBus# is 1>x</CFIF>)/T (SchoolBus)>>
          << /V (<CFIF #GetAccident.RailRoad# is 1>x</CFIF>)/T (RailRoad)>>
          << /V (<CFIF #GetAccident.MAB# is 1>x</CFIF>)/T (MAB)>>
          << /V (<CFIF #GetAccident.HitandRun# is 1>x</CFIF>)/T (HitAndRun)>>
          << /V (<CFIF #GetAccident.Supplement# is 1>x</CFIF>)/T (Supplement)>>
          << /V (#GetAccident.CountyName#)/T (CountyName)>>
          << /V (#GetAccident.CityName#)/T (CityName)>>
          << /V (#GetAccident.DistanceCity#)/T (DistanceCity)>>
          << /V (<CFIF #GetAccident.DirectionCity# is 'North'>x</CFIF>)/T (DirectionCity_N)>>
          /F (PathName/PDF_FILE.pdf)

          <</Root 1 0 R>>
          • 2. Re: CFFORM TO PDF
            You could do like Ted Daniels said and save the information into a database and then read it back into a PDF Template that you create in Acrobat/Live Cycle. I would suggest getting the information from the database and then create an XML structure. You can then populate the template with the XML structure.

            The nice thing about using the XML structure is that you don't have to put the fields in the exact order and if you have extra tags in the XML structure it doesn't matter to the template because it only cares about the tags that exactly match the field names. I think it's a bit easier to understand what's going on as well. Here is an example: