Customization


CSS Injection

By appending an HTTP URL containing valid CSS code to the API's css_url parameter custom styles can be injected into the target URL/HTML before a PDF conversion is performed.

The sample API request below contains a link to an example CSS StyleSheet containing the following declaration:

Example API Request:

Delay

The PDFlayer API's delay parameter enables you to specify a custom delay time (in milliseconds) before the PDF is generated. This feature may be useful if certain content of the target website appears after the initial page load. (e.g. CSS animations, JavaScript effects, etc.)

Example API Request:

Parameter Specification:

ParameterSupported Delay RangeDefault
delay10 < 20000 (0.01 seconds < 20 seconds)-

DPI Resolution

By default, PDFs are generated with an overall DPI (Dots Per Inch) of 96. A custom overall DPI resolution can be specified by appending the API's dpi parameter and setting it to your preferred numerical DPI value.

Example API Request:

Parameter Specification:

ParameterSupported DPI RangeDefault
dpi10 < 1000096

Zoom Factor

By default, PDF document content is generated according to the size and dimensions of the original URL/HTML content. Using the API's zoom parameter a custom HTML zoom factor between 0 and 50 can be specified.

Example API Request:

Parameter Specification:

ParameterSupported Zoom RangeDefault
zoom0 < 50-

Page Numbering

The PDFlayer API provides a set of pre-composed page-numbering tags that can be used to compile custom header or footer numbering text. Each of the page numbering tags listed in the table below can be used in combination with the header_text or footer_text parameters.

Example API Request:

Supported page numbering tags:

TagDescription
[page]Number of the page currently being printed
[frompage]Number of the first page to be printed
[topage]Number of the last page to be printed
[webpage]URL of the webpage being printed
[date]Current date in system local format
[isodate]Current date in ISO 8601 extended format
[time]Current time in system local format
[title]Title of the current page object
[doctitle]Title of the output document
[sitepage]Number of the page in the current site being converted
[sitepages]Number of pages in the current site being converted

Page Numbering Offset

By default, the PDFlayer API's page numbering offset is set to 0, which means that page numbering starts on the first printed page of the PDF document.

A custom page numbering offset can be specified by appending the API's page_numbering_offset and setting it to the number of pages to be skipped before page numbering begins.

Example API Request:

Watermark

The PDFlayer API offers the possibility to use an HTTP URL to add a customizable watermark image to the final PDF document. Using the API's watermark_url parameter an HTTP URL containing a PNG (recommended) or JPG can be specified.

Watermark Opacity

A watermark's default opacity is set to 20 (20%). Using the API's watermark_opacity parameter a custom numeric opacity value can be configured.

Example API Request:

Parameter Specification:

ParameterConditionDefault
watermark_urlSupported image formats: PNG, JPG-
watermark_opacitynumeric20 (20%)

Watermark Positioning

By default, watermark images are aligned at the top left of the page. Two parameters are offered that can be used to horizontally and vertically align a watermark image: watermark_offset_x and watermark_offset_y.

Watermark Placement

By default, watermark images are placed in front of the PDF document's content (texts, images, etc.). By setting the API's watermark_in_background to 1 watermark images will be placed in the PDF document's background.

Example API Request:

Parameter Specification:

ParameterConditionDefault
watermark_offset_xnumeric-
watermark_offset_ynumeric-
watermark_in_backgroundSet to 1 to activate-

 

Questions? Contact Sales .
Need help? Contact Support .
© 2025 APILayer. All rights reserved.