Differences between cfdocument and cfhtmltopdf

cfdocument and cfhtmltopdf tags

cfdocument

cfhtmltopdf

cfdocument supports providing username and password if the source URL is protected through BasicAuth.

No such provision in cfhtmltopdf

Cfdocumentsection tag is present

No equivalent of cfdocumentsection in cfhtmltopdf.

You can create bookmarks, for example, <cfdocument bookmark=”yes”>

No bookmark support.

Can work behind a proxy server.

Cannot work behind a proxy server.

cfhtmltopdfitem tag

In the cfhtmltopdfitem tag, we added the attribute evalAtPrint in ColdFusion (2016 release) Update 3. If set to true, then the content of cfhtmltopdfitem is evaluated after the PDF has been generated and the page numbers are available for each page. This allows you to include conditional code inside the cfhtmltopdfitem tag.

However, in cfhtmltopdf, there is limited CSS support for header and footer content. The cfhtmltopdfitem tag does not support full HTML content in header or footer of the output pdf. This tag only supports these five HTML tags: <body>, <p>, <i>, <b> and <span>.

For example, the following code works:

<cfhtmltopdf destination="c:\out\myPDF1.pdf" source="https://www.google.com" overwrite="true"><cfhtmltopdfitem type="header">
 <b>Page: _PAGENUMBER of _LASTPAGENUMBER</b>
</cfhtmltopdfitem>
<cfhtmltopdfitem type="pagebreak" />
<cfhtmltopdfitem type="footer">
 <cfoutput>
  <p><b><i>Test footer</i></b></p>
 </cfoutput>
</cfhtmltopdfitem>
</cfhtmltopdf>

But, for example, the following snippet, when used, throws an exception.

<cfhtmltopdfitem type="footer">
 <cfoutput>
  <h1>Test footer</h1>
 </cfoutput>
</cfhtmltopdfitem>

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online