Convert URL to PDF
Convert → Convert URL to PDF
The Convert URL to PDF API converts a web page at a URL into a PDF. You send webUrl, authType (NoAuth/Basic), optional username/password, docContent (empty for URL conversion), docName, layout, format, scale, margins, printBackground, displayHeaderFooter, and IsAsync. The API returns the PDF (or 202 + Location for async). Use the tester below to try it; more details are in the sections that follow.
Try the Convert URL to PDF API
Endpoint: POST /api/v2/ConvertUrlToPdf · Required: api-key, webUrl, authType, docContent, docName, layout, format, scale, margins, printBackground, displayHeaderFooter, IsAsync
Use the form below to send your API key, web URL, auth (if needed), output name, layout, format, scale, margins, and options. The response is the PDF (or polling URL when async). No code required—fill the fields and click Send request.
Overview, parameters, and use cases
- Overview
- Parameters
- Use cases
What is Convert URL to PDF?
This endpoint converts a live web page (URL) into a PDF. You provide webUrl, authType (NoAuth or Basic; username/password if Basic), docName, layout (portrait/landscape), format (A0–A8, etc.), scale, margins, printBackground, displayHeaderFooter, and IsAsync. The API captures the page (CSS, images, layout) and returns the PDF or a Location URL for async.
Key features
- Live URL – Fetches and renders the page at webUrl.
- Auth – NoAuth or Basic (username/password) for protected pages.
- Layout and format – Same options as Convert HTML to PDF (layout, format, scale, margins).
- Async – IsAsync returns 202 with Location URL for polling.
Use when you need a PDF of a live web page (e.g. article, dashboard). For static HTML content use Convert HTML to PDF.
API parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| api-key | string | Yes | Your PDF4me API key, Base64 encoded. Get it from the dashboard. |
| webUrl | string | Yes | Web URL of the page to convert (e.g. https://example.com). |
| authType | string | Yes | NoAuth or Basic. |
| username, password | string | No | For Basic auth. |
| docContent | string | Yes | Leave empty for URL conversion. |
| docName | string | Yes | Output PDF file name. |
| layout | string | Yes | portrait or landscape. |
| format | string | Yes | Page format (A0–A8, Tabloid, Legal, etc.). |
| scale | number | Yes | Scale factor (e.g. 1.0 = 100%). |
| topMargin, leftMargin, rightMargin, bottomMargin | string | Yes | Margins (e.g. 20px). |
| printBackground, displayHeaderFooter | boolean | Yes | Include background; show header/footer. |
| IsAsync | boolean | Yes | Enable asynchronous processing. |
When to use Convert URL to PDF
- Articles and pages – Save a web article or page as PDF.
- Dashboards – Capture a live dashboard or report URL as PDF.
- Archival – Create a PDF snapshot of a URL for records.
For request/response schemas and code samples, see Convert URL to PDF in the PDF4me API docs.
Prerequisites
Before using this endpoint, make sure you have:
- A valid PDF4me API key (Get your API Key)
- A valid web URL to convert
Response Format
The API returns a PDF document:
- Status 200: URL to PDF conversion completed immediately - binary PDF content in response body
- Status 202: Request accepted and processing asynchronously - use the Location header URL to poll for results
For asynchronous requests, poll the Location URL until status 200 is returned with the PDF document.