Skip to content

Generate a PDF

POST /generate

Generates a new PDF for the given templateUrl and projectId.

Request Body

  • projectId number required

  • templateUrl string required

  • assetContentDisposition? string

    Sets the Content-Disposition for the file being saved. This specifies how the browser handles the object's content. It controls whether the content is displayed inline in the browser or treated as an attachment for download. This header is useful for prompting users to download a file instead of viewing it directly in their browser.

    For more information, see https://www.rfc-editor.org/rfc/rfc6266#section-4

  • format?

    The valid paper format types for printing a PDF include several different sizes. These sizes are:

    • Letter 8.5in x 11in
    • Legal 8.5in x 14in
    • Tabloid 11in x 17in
    • Ledger 17in x 11in
    • A0 33.1in x 46.8in
    • A1 23.4in x 33.1in
    • A2 16.54in x 23.4in
    • A3 11.7in x 16.54in
    • A4 8.27in x 11.7in
    • A5 5.83in x 8.27in
    • A6 4.13in x 5.83in
  • height? number | string

    Sets the height of paper. You can pass in a number or a string with a unit.

  • landscape? boolean - default false

Whether to print in landscape orientation.

  • preferCSSPageSize? boolean - default false

    Give any CSS @page size declared in the page priority over what is declared in the width or height or format option.

  • puppeteerOptions? object

  • viewport? object

    The viewport to be used before navigating to the templateUrl, helps with establishing the correct media queries and CSS layout.

    Note: width and height must be provided.

    • viewport.width number

    The page height in pixels.

    • viewport.height number

    The page width in pixels.

  • width? number | string

    Sets the width of paper. You can pass in a number or a string with a unit.