cfhtmltopdfitem

Header Footer PageBreak subdefinition for cfhtmltopdf.

You can access the following scope variables in content:

_PAGENUMBER – Add current page number.
_LASTPAGENUMBER – Add last page number.

  <cfhtmltopdfitem>

 cfhtmltopdfitem();

This tag requires Adobe ColdFusion 11 and up.  Not supported on Lucee, etc.

Attribute Reference

type string
Required

Specifies the action:

header: uses the text/image specified between the and tags as the running header.
footer: uses the text/image between the and tags as the running footer.
pagebreak: can be used to insert a pagebreak in the generated PDF. When is used as a service, pagebreak will not work.
Values:
  • header
  • footer
  • pagebreak

isBase64 boolean

Use this only when the image attribute is given a base64 image string

image string

The image file name or object to be used as header or footer.

The following parameters are supported:

A path to the image file
A Base-64 string
A byte array
A object

opacity numeric
Default: 10

Opacity of the header/footer. Specify a valid number. A number between 1 and 10.

numberformat string
Default: Numeric

The page number format to be used.
Values:
  • LOWERCASEROMAN
  • NUMERIC
  • UPPERCASEROMAN

showonprint boolean

Show or hide header/footer when the document is printed.

align string
Default: Center

Alignment of the text. Left, Right, or Center.
Values:
  • Left
  • Right
  • Center

leftmargin numeric
Default: 1.0

Left margin in inches (default) or centimeters. To specify the left margin in centimeters, include the unit=cm attribute.

rightmargin numeric
Default: 1.0

Right margin in inches (default) or centimeters. To specify the left margin in centimeters, include the unit=cm attribute.

topmargin numeric
Default: 0.5

Top margin in inches (default) or centimeters. To specify the left margin in centimeters, include the unit=cm attribute.

bottommargin numeric
Default: 0.5

Bottom margin in inches (default) or centimeters. To specify the bottom margin in centimeters, include the unit=cm attribute.

Examples
Sample code using the cfhtmltopdfitem tag

<cfhtmltopdf destination="myPDF.pdf" source="http://somesite.com" overwrite="true">
 <cfhtmltopdfitem type="header">
 Page: _PAGENUMBER of _LASTPAGENUMBER 
 </cfhtmltopdfitem>
 <cfhtmltopdfitem type="pagebreak" />
 <cfhtmltopdfitem type="footer" image="test.jpg">
 </cfhtmltopdfitem>
</cfhtmltopdf>

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub