Get PDF
AI-generatedSummary
Generate a PDF from a page
Inputs
- url (required) — Target page URL to print as PDF.
- dataPropertyName (required) — Name of the binary property where the generated PDF data will be stored.
- pageRanges — Paper ranges to print, e.g., '1-5, 8, 11-13'.
- scale (required) — Scale factor for rendering, between 0.1 and 2.
- preferCSSPageSize (required) — When false, CSS @page size overrides width/height/format.
- format — Paper format when preferCSSPageSize is false; default 'Letter'.
- height — Custom page height (e.g., '11in').
- width — Custom page width (e.g., '8.5in').
- landscape (required) — Whether to print in landscape orientation.
- margin — Margin settings for the PDF; collection with Top, Bottom, Left, Right.
- displayHeaderFooter (required) — Whether to include header/footer in the PDF.
- headerTemplate — HTML template for header, using placeholders date, title, url, pageNumber, totalPages.
- footerTemplate — HTML template for footer, using placeholder date.
- omitBackground (required) — Hide the default white background, enabling transparent PDFs.
- printBackground (required) — Include background graphics in the PDF.
- queryParameters — Query parameters to append to the URL.
- options — Additional runtime options such as batch size, browser WebSocket endpoint, device emulation, etc.
Output shape
Array of items, each containing binary PDF data under the configured dataPropertyName and JSON metadata (headers, statusCode, url).
Binary data is returned as a base64‑encoded Buffer; optional filename can be set via fileName; empty result if PDF generation fails.
Examples
Example 1: Create a PDF of https://example\.com and store it as binary data.
url: https://example.com, dataPropertyName: pdfData, Landscape: true, Format: Letter, Omit Background: false, Print Background: true, Margin: {top:'0.5in',bottom:'0.5in'}, Display Header Footer: false
Example 2: Generate a landscape A4 PDF with custom header/footer and scale 1.5.
url: https://example.com/report, Landscape: true, Format: A4, Scale: 1.5, Prefer CSS Page Size: false, Height: '', Width: '', HeaderTemplate: '
Example 3: Download a PDF generated via query parameters and save with a custom filename.
url: https://api.example.com/report?format=pdf, Query Parameters: {name:'format',value:'pdf'}, fileName: 'report.pdf', dataPropertyName: 'binaryPdf', Landscape: true