v1
latestSwagger 2.02026-07-1371041.4 KBConvert HTML or URL to PDF
Converts a web URL or raw HTML string to PDF. Sync by default; set async=true to return a Job-Id immediately and poll /api2/asyncjob.
License key required. Success emits X-SelectPdf-Pages, X-SelectPdf-Mode: production, X-SelectPdf-Execution, and X-SelectPdf-Credits-Total / -Remaining.
Request body
License key. Required for /api2/convert; ignored on /api2/convert/demo.
If true, submit asynchronously and return 202 + a Job-Id header. Poll /api2/asyncjob.
Web URL to convert. Required if html is empty. Mutually exclusive with html.
Raw HTML string to convert. Required if url is empty.
Base URL used to resolve relative paths inside html.
Filename suggested via Content-Disposition (default: Document.pdf).
Output page size.
Custom page width in points (1 pt = 1/72 in). Overrides page_size when both page_width and page_height are non-zero.
Custom page height in points.
Top margin in points.
Right margin in points.
Bottom margin in points.
Left margin in points.
Rendering engine. WebKit (default) — broadest compatibility. Restricted — WebKit with limited JS. Blink — older Chromium fork. Chromium — modern Chromium/CEF (recommended for new integrations, required by the demo endpoint).
TLS protocol selector for fetching url. 0 = default (negotiate).
Browser viewport width in pixels used while rendering.
Viewport height in pixels. 0 = automatic (engine picks based on content).
Minimum time (seconds) the engine waits after page load before producing the PDF (lets late-loading scripts settle).
Hard ceiling (seconds) for page load. On the demo endpoint this is clamped to 15.
Honor CSS @media print rules instead of @media screen.
PDF page background color (e.g. #FFFFFF).
If false, the HTML's own backgrounds are stripped (transparent PDF).
Suppress in-document anchor hyperlinks.
Suppress hyperlinks pointing outside the document.
If max_load_time expires, render whatever loaded instead of failing.
Avoid splitting images across page breaks.
Produce a single tall page sized to fit the entire content.
PDF metadata: title.
PDF viewer page layout: 0=SinglePage, 1=OneColumn (default), 2=TwoColumnLeft, 3=TwoColumnRight, 4=TwoPageLeft, 5=TwoPageRight.
PDF viewer page mode: 0=UseNone (default), 1=UseOutlines, 2=UseThumbs, 3=FullScreen, 4=UseOC, 5=UseAttachments.
Render a header band on each page sourced from header_url or header_html.
Header band height in points.
URL whose rendered output becomes the page header.
Inline HTML used as the page header (alternative to header_url).
Render page numbers in the footer band.
Page number assigned to the first page (lets you offset numbering).
Number of leading pages to suppress numbering on.
Template using {page_number} and {total_pages} placeholders.
1=Left, 2=Center, 3=Right.
Hex color for the page numbers (e.g. #000000).
Vertical position of page numbers in points from the bottom.
Semicolon-separated CSS selectors. Matched elements become PDF bookmarks.
Semicolon-separated CSS selectors. Matched elements are hidden before rendering.
Render only the element with this id (everything else hidden).
Semicolon-separated CSS selectors whose bounding boxes are reported back via X-SelectPdf-Web-Elements (sync) or /api2/webelements (async).
Password required to open the PDF. Rejected by the demo endpoint.
Password required to modify / print the PDF. Rejected by the demo endpoint.
HTTP Basic-Auth username used when fetching url.
Cookie name → value map sent when fetching url (JSON body only).
Query-string-encoded cookies (form / GET equivalent of cookies).
Engine startup mode hint (automatic, manual).
If true, treat the URL as already-decoded (do not re-percent-decode). Internal default for forwarded calls.
Optional JSON blob containing this entire object. When present, the receiver deserializes it and ignores all other form fields. Used by the SDK's remote-worker proxy.
0 = binary/octet-stream (default, makes browsers download). 1 = application/pdf (browsers may render inline).
Example request
{
"key": "d290f1ee-6c54-4b01-90e6-d701748f0851",
"url": "https://selectpdf.com",
"html": "<b>test html string</b>"
}Response
PDF returned in the response body. X-SelectPdf-Pages carries the page count.