Document Configuration


Document Name

By default, PDF documents generated by the PDFlayer API are named pdflayer.pdf. Using the API's document_name parameter you can specify a custom name for your final PDF document.

Example API Request:

Parameter Specification:

ParameterConditionDefault
document_nameMax. 180 characterspdflayer.pdf

Document Units

The default document unit is px. A custom unit can be specified by appending the API's custom_unit parameter and setting it to one of the four supported document units.

Example API Request:

Parameter Specification:

ParameterSupported UnitsDefault
custom_unitmm, in, px, ptpx

HTTP User-Agent Header

The API's user_agent parameter is used to adjust the final PDF document to a certain device setting. In many cases, this parameter is used to ensure more consistent functionality of the Viewport Control feature.

To specify a custom HTTP User-Agent header, simply append the respective User-Agent string to the user_agent parameter.

Example API Request:

Common HTTP User-Agent Headers:

SystemUA String
Chrome Generic Win7 64-bitMozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36
Chrome Generic MacOSXMozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36
Safari 8.0 MacOSXMozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/600.6.3 (KHTML, like Gecko) Version/8.0.6 Safari/600.6.3
Firefox Generic Win7 64-bitMozilla/5.0 (Windows NT 6.1; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0

Find a detailed list of HTTP User-Agent headers here »

HTTP Accept-Language Header

By default, PDF documents processed by the PDFlayer API don't come with a specific HTTP Accept-Language header. An Accept-Language header can be specified by appending the respective string to the API's accept_lang parameter.

Example API Request:

Common HTTP Accept-Language Headers:

LanguageAccept-Language String
English (general)en
Germande
Spanishes
Italianit
English (US)en-US
English (UK)en-GR
Spanish (Spain)es-ES
Spanish (Mexico)es-MX

You can find a comprehensive list of accept-language strings here.

Text Encoding

By default, PDFlayer API requests come with a standard UTF-8 text encoding header. A custom text encoding header can be specified simply by appending the respective text encoding string to the API's text_encoding parameter.

Example API Request:

Parameter Specification:

ParameterConditionDefault
text_encoding-UTF-8

TTL (Caching Time)

By default, generated PDFs are cached for a period of 30 days (2,592,000 seconds). Using the API's ttl parameter, you can specify a custom caching time (in seconds) lower than the default setting.

The example API query below requests the final PDF to be cached for 259,200 seconds (3 days).

Example API Request:

Parameter Specification:

ParameterConditionDefault
ttlMaximum value: 25920002592000

Force New PDF

As mentioned earlier, by default PDF documents are cached for 30 days upon creation. (Learn more about TTL - Caching Time)

By setting the PDFlayer API's force parameter to 1 the API will be requested to generate a new PDF each time the API request URL is called.

Example API Request:

Please Note: Each call of an API request URL including the force functionality counts towards your monthly API request volume.

Inline/Attachment Parameter

By default, accessing a PDFlayer API request URL in a browser will trigger the download of the generated PDF (attachment behaviour). By setting the API's inline parameter to 1 the API will be requested to display the PDF in the browser instead (inline behaviour).

Example API Request:

Parameter Specification:

ParameterConditionDefault
inline-Deactivated - Attachment, triggering download

Password-Protected Sites

The PDFlayer API can also generate PDFs from password-protected websites. The parameters auth_user and auth_pass are used to authenticate with a password-protected website.

Example API Request:

Parameter Specification:

ParameterConditionDefault
auth_userMaximum: 1,000 characters-
auth_passMaximum: 1,000 characters-

PDF Encryption

There are two encryption levels available for PDFs generated by the PDFlayer API: 40-bit and 128-bit. In order to activate encryption, set the API's encryption parameter to 40 or 128.

Example API Request:

Parameter Specification:

ParameterSupported Encryption LevelsDefault
encryption40, 128-

PDF Authentication

The PDFlayer API offers two levels of PDF password protection: owner password and user password. These can be specified by appending the owner_password and/or user_password parameter(s) and setting them to their respective password value.

Supplying an owner password grants unlimited access to the PDF, including the ability to change the password and Permission Options. A user password, on the other hand, must be supplied to view the document and perform operations allowed by the Permission Options.

Example API Request:

Parameter Specification:

ParameterSupported Encryption LevelsDefault
owner_passwordMaximum: 32 characters-
user_passwordMaximum: 32 characters-

Misc Options

In addition to the above-mentioned document configuration parameters, there is a series of extra settings that can be specified for the final PDF document. Please find them in the table below:

Example API Request:

Parameter Specification:

ParameterDescriptionDefault
no_imagesSet to 1 in order to disable images-
no_hyperlinksSet to 1 in order to disable hyperlinks-
no_backgroundsSet to 1 in order to disable CSS backgrounds-
no_javascriptSet to 1 in order to disable JavaScript-
use_print_mediaSet to 1 in order to activate CSS @media print declarations-
grayscaleSet to 1 in order to remove all colours-
low_qualitySet to 1 in order to generate low quality PDF-
formsSet to 1 in order to enable forms on your PDF-

Permission Options

There are several permission options that can be configured before generating a PDF using the PDFlayer API. After creating the PDF, these options can only be altered or disabled by a user supplying an owner password. Learn more about PDF Authentication »

Please note that the specification of at least one of the following parameters is required to be able to configure permission options: owner_password, user_password or encryption

Example API request using permission options:

Parameter Specification:

ParameterDescriptionDefault
no_printSet to 1 in order to disable printing of the final PDF document-
no_modifySet to 1 in order to disable modification of the final PDF document-
no_copySet to 1 in order to disable the possibility to copy any text of the final PDF document-

 

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