Customizing the PDF
Learn how to set margins, headers, footers and other options.
Job parameters
When creating jobs, the following parameters are available to customize the PDF output.
You can set these parameters either as form data or as a JSON object in the body of the request.
This is an example of submitting parameters as a JSON object, using the curl
command line tool. This example uses an external file - body.json
- which contains the API parameters as JSON-formatted data.
Parameter name | Description |
| The url parameter is required and is the web address that will be loaded and used to render the PDF. |
| Set this to “true” to use landscape orientation. Default: false |
| Use these parameters to set the size of the page margins. The value must be a number and by default will be interpreted as inches. You can set a margin size in centimetres by suffixing the value with “cm”. For example, these are all valid margins:
Default: 1cm |
| The page size can be set to one of the following values:
Alternatively you can specify a custom page size. See the section on custom page sizes below to learn how to do this. Default: Letter |
| Allows you to scale the size of the page content up or down. The minimum scale value is 0.1 and the maximum is 2. Default: 1 |
| Set this to "true" to ignore any print styles on the page, and instead emulate the screen CSS media type. Default: false |
| These parameters allow you to provide an HTML template that will be used to insert a header or footer on each page. Take a look at the header and footer templates guide for more information about setting up a template. Default: No header or footer |
| Set this to "true" to cause Paperplane to wait until network activity has paused before generating the PDF. This option is useful if you're using a client-side framework like React or Angular to build your document. When using client-side frameworks, PDFs can sometimes be captured too early and miss some content or images. By waiting until all network activity has stopped for a short period, it's usually possible to reliably generate the PDF once all page content has been loaded. Using this option is recommended if you're using any sort of client-side javascript framework. Default: false |
| For use in conjunction with The Default: 2 seconds (used if |
| If the page content isn't immediately visible, you can instruct Paperplane to wait up to 20 seconds before generating the PDF. This delay will allow time for your content to fully load. The Default: 3 seconds |
| If the page content is not immediately visible, you can instruct Paperplane to wait for an element matching a specific CSS selector to be loaded. This is an alternative to the You can set
Default: Not set (Does not wait for any matching element) |
| Sets a custom file name to use when uploading to S3. If not set, the PDF will be uploaded as
Files can be placed in a directory structure by using Note that if you use the same file name twice, the existing file will be overwritten. Adding a Default: |
| Setting this to "true" will result in the file being downloaded by the browser rather than displayed inline. This option is mainly useful when making PDFs directly downloadable. If you're generating a pre-signed URL using the Amazon SDK, then you have the option of setting "content disposition" to "attachment" when generating the URL, which will have the same effect. Default: false |
| If set, this username will be used if HTTP Basic Auth is requested. For more information see our guide on securing access to documents. Default: Not set |
| If set, this password will be used if HTTP Basic Auth is requested. If For more information see our guide on securing access to documents. Default: Not set |
| Setting this to "true" will result in the PDF conversion job failing (with the Default: false |
Custom page sizes
To use a custom page size, provide height
and width
values within the page_size
parameter.
Here's an example of specifying a custom page size using JSON:
Size units
You can specify page height or width in millimetres (mm
) or inches (in
). If you don't specify a unit, inches are assumed. For example, these are all valid heights or widths:
11.5in
8in
300mm
155mm
12
(interpreted as 12 inches)
Last updated