John
John

Reputation: 13699

Creating a PDF in ColdFusion?

How can dynamic HTML be put into a PDF using ColdFusion?

This is in relation to my question about getting IE to work properly with a CFDIV.

What I am trying to do is something similar to this

<cfdocument 
name="table"
format="PDF"> 
foo
<cfdiv id="content" bind="cfc:TestCFC.displayTable({filters})"></cfdiv>
bar
</cfdocument>

however when I open my PDF document, I only see

foo
bar

I would like a solution that uses the CFDIV with the bind, however if that is not an option than any solution will do.

Upvotes: 0

Views: 607

Answers (1)

Dan Short
Dan Short

Reputation: 9616

You can't use bind parameters for pdfs because the bind parameters are executed via AJAX on the client. You'll need to do something like this instead:

<cfdocument name="table" format="PDF"> 
foo
<cfdiv id="content"><cfoutput>#TestCFC.displayTable({filters})#</cfoutput></cfdiv>
bar
</cfdocument>

And you'll need to get the filters argument in there via some other method than a bind to another element. Possibly a FORM or URL variable when the user clicks the link or button to generate the PDF.

Upvotes: 7

Related Questions