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.

body.json
{
  "url": "https://en.wikipedia.org/wiki/Airplane",
  "footer_template": "<div style=\"width=100%; font-size: 12px; text-align: center\">Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>",
  "margin_bottom": "2cm"
}
$ curl -u myapp-api-key: \
  --data @body.json \
  --header "Content-Type: application/json" \
  https://api.paperplane.app/jobs

{
  "id": "29d89d2f-1a4f-4bcc-a2ff-16ca6e90e635",
  "url": "https://en.wikipedia.org/wiki/Airplane",
  "status": "queued",
  "done": false,
  "object": "job"
}

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:

{
  "url": "https://en.wikipedia.org/wiki/Paper_size",
  "page_size": {
    "height": "10in",
    "width": "10in"
  }
}

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