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, OpenBD, etc.

cfhtmltopdfitem Attribute Reference

type
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 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

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

image

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
Default: 10

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

numberformat
Default: Numeric

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

showonprint

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

align
Default: Center

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

leftmargin
Default: 1.0

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

rightmargin
Default: 1.0

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

topmargin
Default: 0.5

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

bottommargin
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


Adobe Example

<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>

Fork me on GitHub