OpenBD Wiki

From OpenBD
Jump to: navigation, search

CFDOCUMENT

Contents

Description

CFDOCUMENT allows you to construct and produce PDF files

The following attributes are currently unsupported: fontEmbed, bookmark, scale, backgroundVisible, localUrl

Attributes

The following attributes are supported in Open BlueDragon:

  • Encryption
  • Format (PDF only)
  • Font Embed
  • Mimetype
  • Orientation (Landscape or Portrait)
  • Overwrite
  • Pagetype
  • Unit (IN or CM)
  • Useragent
  • Marginleft
  • Margintop
  • Marginright
  • Marginbottom
  • Proxyhost
  • ProxyPort
  • Proxyuser
  • ProxyPassword
  • SRC (cannot be used in conjunction with SrcFile)
  • SRCFile (cannot be used in conjunction with Src)
  • FileName (saves pdf to disk)
  • Name (saves pdf to a variable)
  • SaveAsName
  • OwnerPassword
  • UserPassword
  • Permissions

Usage

A simple PDF that will be returned in the request:

<cfdocument format="pdf">
Hello World!
</cfdocument>

The following demonstrates the use of cfdocumentitem to insert the header/footer.

<cfdocument format="pdf" src="http://openbluedragon.org">
  <cfdocumentitem type="header">This is the header</cfdocumentitem>
  <cfdocumentitem type="footer"><cfoutput>Page #cfdocument.currentpagenumber#</cfoutput></cfdocumentitem>
</cfdocument>

Additional Information

JTidy, the one of the libraries behind CFDocument, requires valid XHMTL markup as the HTML markup is validated before it is sent for PDF processing.

Be on the watch out for:

  • Empty <p> tags will not be rendered as empty elements are not considered valid HTML markup. Workaround: <p>&nbsp;</p>

Personal tools