Overview
Renders the session’s active page as a PDF via Chrome’s Page.printToPDF and returns the binary PDF in the response body. Response Content-Type is application/pdf.
Path Parameters
Browser session ID (UUID).
Body
Optional URL to navigate to before rendering. If omitted, the current page is printed.
Paper format. One of Letter, Legal, Tabloid, Ledger, A0, A1, A2, A3, A4, A5, A6. When set, overrides paperWidth / paperHeight.
Include background colors and images.
Paper width in inches. Ignored when format is set.
Paper height in inches. Ignored when format is set.
One-based page ranges, e.g. 1-5, 8, 11-13.
Display the header and footer templates.
HTML template for the header. Supports CSS classes date, title, url, pageNumber, totalPages.
HTML template for the footer. Same substitutions as headerTemplate.
When true, prefer page size defined by @page CSS rules.
Example Request
cURL (current page, default)
cURL (navigate + A4 landscape)
curl -X POST "https://api.scrapengine.io/api/v1/browser/sessions/baa3f390-fa6e-4a24-b84a-a575a5f3a9c7/pdf" \
-H "Authorization: Bearer $SCRAPENGINE_API_KEY " \
-H "Content-Type: application/json" \
-d '{}' \
-o output.pdf
Response
Success Response (200)
Binary PDF. Response headers:
Content-Type: application/pdf
Pipe to a file with -o output.pdf in cURL, or read response.body as bytes.
Error Responses
Status Description 400Invalid body — unknown format, bad margin, or scale out of range. 401Unauthorized — invalid or missing API key. 404Session not found or not owned by the caller. 503The browser session is temporarily unreachable.