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:
| Parameter | Condition | Default |
|---|---|---|
document_name | Max. 180 characters | pdflayer.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:
| Parameter | Supported Units | Default |
|---|---|---|
custom_unit | mm, in, px, pt | px |
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:
| System | UA String |
|---|---|
| Chrome Generic Win7 64-bit | Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 |
| Chrome Generic MacOSX | Mozilla/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 MacOSX | Mozilla/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-bit | Mozilla/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:
| Language | Accept-Language String |
|---|---|
| English (general) | en |
| German | de |
| Spanish | es |
| Italian | it |
| 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:
| Parameter | Condition | Default |
|---|---|---|
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:
| Parameter | Condition | Default |
|---|---|---|
ttl | Maximum value: 2592000 | 2592000 |
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
forcefunctionality 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:
| Parameter | Condition | Default |
|---|---|---|
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:
| Parameter | Condition | Default |
|---|---|---|
auth_user | Maximum: 1,000 characters | - |
auth_pass | Maximum: 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:
| Parameter | Supported Encryption Levels | Default |
|---|---|---|
encryption | 40, 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:
| Parameter | Supported Encryption Levels | Default |
|---|---|---|
owner_password | Maximum: 32 characters | - |
user_password | Maximum: 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:
| Parameter | Description | Default |
|---|---|---|
no_images | Set to 1 in order to disable images | - |
no_hyperlinks | Set to 1 in order to disable hyperlinks | - |
no_backgrounds | Set to 1 in order to disable CSS backgrounds | - |
no_javascript | Set to 1 in order to disable JavaScript | - |
use_print_media | Set to 1 in order to activate CSS @media print declarations | - |
grayscale | Set to 1 in order to remove all colours | - |
low_quality | Set to 1 in order to generate low quality PDF | - |
forms | Set 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:
| Parameter | Description | Default |
|---|---|---|
no_print | Set to 1 in order to disable printing of the final PDF document | - |
no_modify | Set to 1 in order to disable modification of the final PDF document | - |
no_copy | Set to 1 in order to disable the possibility to copy any text of the final PDF document | - |