Copy link to clipboard
Copied
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?
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
That worked, but I'm still perplexed as to why it would not work within the cfdocument tag. Thanks for your help!
Copy link to clipboard
Copied
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-cfdocument.html
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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#bugId=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
Copy link to clipboard
Copied
In my testing CFPDFForm output doesn't get captured by CFSaveContent.
Copy link to clipboard
Copied
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? 😉
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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..).
Copy link to clipboard
Copied
My testing was performed in CF 9,0,1,274733
Copy link to clipboard
Copied
Thanks. FWIW I can confirm your confirmation 😉 Cfsavecontent does not capture the output under 9.0.1.