Jay asks:
I am tryin gto add a button, specifically an email button, to pdf created in CF8. I am not sure how to do this. I thought in CF8 you could create a pdf with CFDocument and in this process add buttons to do whatever. Is this possible? If so how?
I marked this both as a "Ask a Jedi" and "Stump the Chump" because I'm not sure I have the exact right answer. I believe the answer is no though. From what I know - CF8 does let you work with PDF forms that were created in Acrobat/LiveCycle. So it can handle existing forms. It can even put an existing PDF Form inside a PDF made with CFDOCUMENT. But you can't create an interactive form from scratch with CFDOCUMENT.
Now - if you want to get a bit down and dirty - you can use iText. They have a tutorial on creating interactive forms. For an excellent set of examples of using iText in ColdFusion, check out the iText category over at cfSearching.
Archived Comments
Does he mean:
"I want to add a mailto:joe@johndoe.com link within my PDF?"
That, you could probably do with an 'a href' link?
David,
I am guesses he means a button to email the form contents to a specific address after they are filled out. I am agreeing with Ray, that out of the box, I don't think CF does this without iText integration.
You're right, Ray, this can not be achieved with ColdFusion. CF does not have the capability to create dynamic PDF forms. The cfform reference page for CF8, states that you can but that is actually incorrect.
You can easily achieve this using the LiveCycle Designer and it will attach the XML data from the Form using your email application. Then you can take the XML to populate a blank copy of the PDF form. If you want to send the whole PDF document, however, you need to first "bless" it with the Reader Extensions. Hope this helps.
Hi,
In the post he doesn't mention pdf forms? Just that he wants an email button - I take it as a contact us type of link.
As above surely this can be done with a href on an image or text?
<cfdocument format="pdf">
<a href="mailto:yourmail@yourisp.com"><img src="Resources/email_add.png" width="16" height="16" border="0"></a>
</cfdocument>
Peter
Roland is right, you need LiveCycle designer to create the form. It comes with Acrobat Pro (and any version of Creative Suite that includes Acrobat Pro). You can also use a form created in Acrobat (still requires Acrobat Pro, but a little more straightforward).
You can dynamically set where the button sends the email by binding it to a form field (hidden from view with styling) elsewhere in the document, and then setting the value of that form field with ColdFusion.
FWIW, cfdocument/pdf on CF 10 seems to allow <input>, <input type="checkbox"> but not <input type="button"> (also freaked out, wanted a "treeLock" if a <table> didn't have closing </tr>
I wonder how cfhtmltopdf handles it? I'd test, but I can't use it on a Mac.