Skip to main content
Skip table of contents

createPDF

This command has been deprecated. Use html2pdf command instead.

 

This command creates one PDF file out of multiple HTML templates. Command uses PDF rendering pipeline that is optimized for API use.

var

String

Defines the name of the variable holding the created PDF file.

body

DAP Part, File, String

Defines the template for the main document content.

first

DAP Part, File, String

Defines the template for the first page of the document.

bodyHeader

DAP Part, File, String

Defines the template for the document header.

bodyFooter

DAP Part, File, String

Defines the template for the document footer.

bodyProperties

Map

Defines the properties for the body. If bodyProperties attribute is given, @page will be ignored completely in CSS.

The following Map entries are possible:

  • marginTop defines the value of the top margin for the main template.

  • marginRight defines the value of the right margin for the main template.

  • marginBottom defines the value of the bottom margin for the main template.

  • marginLeft defines the value of the left margin for the main template.

  • marginTopHeader defines the value of the top margin for the header.

  • marginBottomFooter defines the value of the bottom margin for the footer.

  • pageFormat defines the format type for the main template. Valid options are: 'letter' | 'legal' | 'tabloid' | 'ledger' | 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6'.

  • landscape defines whether the main template is in landscape (true) or in portrait (false).

  • pageWidth defines the width of the main page.

  • pageHeight defines the height of the main page.

Values for the margins and page height and width can be anything that CSS accepts. Values without units will be resolved into px-units. Default value for the margins is '0px'.

Default value for the landscape property is false.

If pageFormat is set, it takes priority over the page height and width. If pageWidth is set, then pageHeight must be set and vice versa. If none is set, default value is 'a4' with its height and width.

If header/footer template is introduced, it is recommended to give them space by adjusting the body's marginTop/marginBottom property. Otherwise the content of the body may overlap header and footer.

firstProperties

Map

Defines the properties for the cover. If firstProperties attribute is given, @page will be ignored completely in CSS.

The following Map entries are possible:

  • marginTop defines the value of the top margin for the cover.

  • marginRight defines the value of the right margin for the cover.

  • marginBottom defines the value of the bottom margin for the cover.

  • marginLeft defines the value of the left margin for the cover.

  • pageFormat defines the format types for the cover. Valid options are: 'letter' | 'legal' | 'tabloid' | 'ledger' | 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6'.

  • landscape defines whether the cover is in landscape (true) or in portrait (false).

  • pageWidth defines the width of the cover page.

  • pageHeight defines the height of the cover page.

Values for the margins and page height and width can be anything that CSS accepts. Values without units will be resolved into px-units. Default value for the margins is '0px'.

Default value for the landscape property is false.

If pageFormat is set, it takes priority over the page height and width. If pageWidth is set, then pageHeight must be set and vice versa. If none is set, default value is 'a4' with its height and width.

CODE
<pdf:createPDF 
  var="pdf" 
  body="${mainTemplate}" 
  bodyHeader="${headerTemplate}" 
  bodyFooter="${footerTemplate}" 
  bodyProperties="${bodyProperties}" 
/>

Since bodyProperties attribute is given, @page is ignored in CSS. Therefore modified settings for the body is possible to implement by building a Map.

CODE
<cv:buildMap var="bodyProperties" >
  <cv:set var="marginTop" value="2cm" />
  <cv:set var="marginRight" value="2cm" />
  <cv:set var="marginBottom" value="2cm" />
  <cv:set var="marginLeft" value="2cm" />
  <cv:set var="marginTopHeader" value="1cm" />
  <cv:set var="marginBottomFooter" value="0cm" />
  <cv:setBoolean var="landscape" value="false" />
  <cv:set var="pageFormat" value="a4" />
</cv:buildMap>
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.