Options
All
  • Public
  • Public/Protected
  • All
Menu

the new options for rendering PDF's using our Chrome backend. If you are using the old WebKit backend, see IPdfOptions_WebKit

Note: by default PDF's use the CSS @screen media type. to change this, set IRenderSettings.emulateMedia to a value such as print

If you want to rename the file (used if the user saves the pdf) set the Content-Disposition header via IRenderSettings.extraResponseHeaders. For example: "Content-Disposition":'attachment; filename="downloaded.pdf"'

Hierarchy

  • IPdfOptions

Index

Properties

Optional footerTemplate

footerTemplate: string

a HTML template, use the following classes to inject print values into their respective elements: date, title, url, pageNumber, totalPages

If the associated margin is not explicitly set, setting a template will automatically set the margin to "1in"

Note: page css is not available to this template, so include inline-css for styling.

example

<span style='font-size: 15px; height: 200px; background-color: black; color: white; margin: 20px;'>Header or Footer. <span style='font-size: 10px;'>Keep templates simple, and inline CSS. Page:<span class='pageNumber'>XX</span>/<span class='totalPages'>YY</span></span></span>

Optional format

format: "letter" | "legal" | "tabloid" | "ledger" | "a0" | "a1" | "a2" | "a3" | "a4" | "a5" | "a6" | "viewport" | "onepage"

pdf paper size to use.

You may choose a standard paper size, or an adaptive size.

standard paper sizes: Letter, Legal, Tabloid, Ledger, and A0 to A6

adaptive sizes:

  • viewport : renders pages the size of the current browser viewport
  • onepage : renders all the browser contents in a single pdf page. It does this by setting the pdf page width to the current viewport width, and pdf page height to the entire page contents height. To better control page width, remember that 96px === 1in. So to have a 8.5inch wide page, set your viewport width to 816 (also consider using zoomFactor to shrink the page contents). onepage is slightly buggy, so to better control page length, you can set the additional onepageFudgeFactor sibling parameter.
default

"letter"

Optional headerTemplate

headerTemplate: string

a HTML template, use the following CSS classes to inject print values into their respective elements: date, title, url, pageNumber, totalPages

alternatively, you could pass the special classes as variables, as shown in this example: <span>Page %pageNumber% of %totalPages%</span>

If the associated margin is not explicitly set, setting a template will automatically set the margin to "1in"

Note: page css is not available to this template, so include inline-css for styling.

example

<span style='font-size: 15px; height: 200px; background-color: black; color: white; margin: 20px;'>Header or Footer. <span style='font-size: 10px;'>Keep templates simple, and inline CSS. Page:<span class='pageNumber'>XX</span>/<span class='totalPages'>YY</span></span></span>

Optional height

height: string

optional pdf page dimensions used if you don't specify format.

pass a number with one of the following units: px, in, cm, or mm.

example

"88cm"

Optional landscape

landscape: boolean

Optional margin

margin: object

optional margin use units such as those used for width or height properties

default

no margin.

Type declaration

  • Optional bottom?: string
  • Optional left?: string
  • Optional right?: string
  • Optional top?: string

Optional onepageFudgeFactor

onepageFudgeFactor: number

only used when format="onepage".

multiplier for pdf page height, to get it to fit on a pdf page. leaves a small blank area at the bottom.

formula is: pdfPageHeight = (browserPageHeight * fudgeFactor) + margins

default

1.05

Optional pageRanges

pageRanges: string

Paper ranges to print, e.g., '1-5, 8, 11-13'.

Optional preferCSSPageSize

preferCSSPageSize: boolean

if set to true, will use the CSS @page size if any is present.

Optional width

width: string

optional pdf page dimensions used if you don't specify format.

pass a number with one of the following units: px, in, cm, or mm.

example

"88cm"