So I'm using the following code to create a PDF from data from a query.
<cfpdfform action="populate" source="test.pdf" destination="GeneratedPDFs/test.pdf" overwrite="yes">
<cfpdfformparam name="FirstLine1" value="#Variables.FirstLine#">
<cfpdfformparam name="SecondLine1" value="#Variables.SecondLine#">
<cfpdfformparam name="AddressBox1" value="#Variables.AddressBox#">
<cfpdfformparam name="Body1" value="#Variables.Body1#">
<cfpdfformparam name="FirstLine2" value="#Variables.FirstLine#">
<cfpdfformparam name="SecondLine2" value="#Variables.SecondLine#">
<cfpdfformparam name="AddressBox2" value="#Variables.AddressBox#">
<cfpdfformparam name="Body2" value="#Variables.Body2#">
</cfpdfform>
<cfpdf action="write" source="GeneratedPostCards/!PostCard2013-Vipre.pdf" destination="GeneratedPostCards/!PostCard2013-Vipre-flat.pdf" flatten="yes" overwrite="true">
</cfpdf>
This works fine, and generates the PDF for me, but I've run into three issues:
If I set a form field in Acrobat Pro DC to a Rich Text, then no matter what font I select, I get Courier. In order to get the font I want, I have to turn off Rich Text.
I'd like to change the line spacing or leading in the multi-line fields, but I don't see a way to do that (either in Acrobat or in ColdFusion).
I'd like to be able to bold, italicize, and change the colour of specific words (not the entire field) and I'm wondering if there are codes I can pass from ColdFusion to do this.
Thanks!
Keep in mind that if you set the
richTextflag of a text field, you will have to userichValuefor the value, andrichValueis an array ofspanobjects, where each object represents a piece of the text with specific properties. The Acrobat JavaScript documentation is your friend…As it is not really possible to directly insert arrays into a PDF form, you might consider representing the richValue arrays as strings, and fill them into hidden "shadow fields". When the document opens, some logic interprets those strings, and fills the
richTextenabled fields with correctrichValuearrays.It may also be good to know that there is no
richDefaultValueproperty, which means that you would have to recreate therichValuewhen you reset the form.