Skip navigation
MercuryNewt
Currently Being Moderated

cfpdfform inside cfdocument outbound as a pdf variable

Apr 22, 2009 4:25 PM

OK, here's the scenario: I have a client who needs to populate a PDF form (1098) using data from a database.  Right now they have code that simply uses cfpdfform to output the finished "populated" PDF.  Now, here's the problem, we would like to abstract this and create a pdf variable, outbound from a function call, that we can then cfcontent to the screen as a PDF.  The docs indicate that you can create a pdf variable from a cfpdfform using cfdocument, however implementing it has been proven to be problematic.  Is it just not possible to create a pdf variable from a cfpdfform embedded in a cfdocument?  Creating a pdf file works fine, but we don't really need the physical file on the server, just the generated pdf output to the screen.  Any suggestions?

  • Currently Being Moderated
    Community Member
    Apr 24, 2009 6:25 PM

    Skip embedding and use cfsavecontent to capture the cfpdfform output in a variable.

     

    <cfsavecontent >

         <cfpdfform  action="populate"  ... (omit destination) ... >

         </cfpdfform>

    </cfsavecontent>

    MercuryNewt wrote:

     

    Is it just not possible to create a pdf variable from a cfpdfform embedded in a cfdocument?

    Yes, you can.  Though you need to use at least on cfdocumentsection and apparently it must be before the cfpdfform tags or it does not work. At least not in my tests.

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Apr 28, 2009 10:43 AM

    I do not normally use embedding, but it did work for me as long as the cfdocumentsection was in the right place.  But, it probably would not be a good solution for this case anyway, because cfdocumentsection adds a page break. So you would have a blank first page.

     

    http://cfsearching.blogspot.com/2009/04/embedding-pdf-form-in-cfdocume nt.html

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Feb 1, 2010 4:09 PM

    Hi Leigh,

     

    When I run the following code (in CF8 & CF9), the cfsavecontent tag is ignored (output is written directly to browser):

     

    <cfsavecontent variable="myVar">
      <cfpdfform source="#expandPath('/path/to/MyPDF.pdf')#" action="populate" />
    </cfsavecontent>

     

    Just curious.. so the cfsavecontent tag was honored for you (output is trapped in variable, and not directly written to browser)?

     

    Thanks!,

    -Aaron Neff

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Feb 7, 2010 8:30 PM

    UPDATE:  It seems "name" is not actually a _documented_  attribute of cfpdfform (only cfpdf).  Aaron mentioned this on another  forum.  If "name" really is undocumented/unsupported, I probably would not use it.  The issue is mentioned in the bug  database #75195. The current status is "Closed", but I do not know the  final outcome (ie fixed/not-fixed.

     

    http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#b ugId=75195

    Just curious.. so the cfsavecontent tag was honored for you

    (output is trapped in variable, and not directly written to browser)?

    Hi Aaron,

     

    I think that was just non-tested psuedo-code. (I am not sure why I did not just suggest using the "name" attribute to capture the output in a variable..) But that does work on CF9

     

    -Leigh

    |
    Mark as:
  • Currently Being Moderated
    Jun 30, 2011 8:18 AM

    In my testing CFPDFForm output doesn't get captured by CFSaveContent.

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jun 30, 2011 9:23 AM

    Wow, this thread is almost two years old... I do not remember the chain of events but does not the last comment mention that being non-tested psuedo-code? ;-)

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jun 30, 2011 9:26 AM

    I realized I was resercting an old thread, but seeing as it had come up in my search and I had tested the code I wanted to confirm that it didn't work so someone else wouldn't need to expend the time testing. Figured feed back was a reasonable community expectation.

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jun 30, 2011 9:45 AM

    Fair enough. Though you might post your full version number as behavior can vary between patches (too bad I did not do that in the earlier comments..).

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jun 30, 2011 9:51 AM

    My testing was performed in CF                  9,0,1,274733 

    |
    Mark as:
  • Currently Being Moderated
    Community Member
    Jun 30, 2011 11:32 AM

    Thanks. FWIW I can confirm your confirmation ;-) Cfsavecontent does not capture the output under 9.0.1.

    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points