PDF Engine - CFDOCUMENT using Flying Saucer

edit

PDF Engine - Flying Saucer (CFDocument)

Flying Saucer is Lucee's modern PDF engine for HTML to PDF conversion (5.3+).

Benefits of moving to Flying Saucer from the old engine (PD4ML)

  • Full support for CSS 2.1
  • On average the generated PDFs are smaller
  • Consume less Memory and CPU
  • Engine in active development,
  • Better Results

Downsides to Flying Saucer compared to the old engine (PD4ML)

  • The generated PDF does not always look exactly the same when generated with the new FC compared to files generated with the PD4ML.

If you need exact PD4ML compatibility, use the classic engine:

Application.cfc:

this.pdf.type = "classic";

Application.cfm:

<cfapplication pdf="#\{type:'classic'\}#">

Per-document (PDF Extension 1.0.0.92+):

<cfdocument type="modern">
  or
<cfdocument type="classic">

Font Directory

Specify where your fonts (.ttf, .otf) are located:

<cfdocument fontDirectory = "path/to/my/font">

Application.cfc:

this.pdf.fontDirectory = "path/to/my/font";

Application.cfm:

<cfapplication pdf="#\{fontDirectory	:'path/to/my/font'\}#">

Default location: /WEB_INF/lucee/fonts

Note: Classic engine uses font names from pd4fonts.properties. Flying Saucer uses font-family-name from the .ttf file (case-sensitive).

Simplified Attributes

Instead of verbose attributes:

<cfdocument marginTop="5" marginBottom="5" marginLeft="5" marginRight="5" pageWidth="5" pageHeight="5" pageType="A4">

Use struct syntax:

<cfdocument margin="#\{top:5,bottom:5,left:5,right:5\}#" page="#\{width:5,height:5,type:'A4'\}#">

Or even simpler (uniform margin):

<cfdocument margin="5" page="#\{width:5,height:5,type:'A4'\}#">

Additional Units

Besides "inch" and "cm", now supports "pixel" and "points":

<cfdocument unit="in|cm|px|pt">

Report issues on the mailing list. See also: Flying Saucer video

See also