apyhub
Back
▣ OUTPUT KIT · MEDIA KIT

Convert Webpage to PDF FIle API

What it does

Web Page to PDF converts a public HTTP or HTTPS URL into a PDF binary. Send a page URL and get back a downloadable PDF, with support for common document settings like paper size, orientation, margins, background printing, and optional PDF/A archival formats.

Use it when you need to capture a live webpage as a fixed document for sharing, archiving, review, or record-keeping. It handles standard paper formats including A4, Letter, Legal, Tabloid, A3, A5, and A6, so you can fit the output to your workflow or print pipeline.

For pages that depend on JavaScript, you can add a wait delay before rendering. You can also supply header and footer HTML that repeats on every page, including page number and total pages placeholders. That makes it a good fit for invoice exports, compliance snapshots, saved reports, and customer-facing document generation from web content.

POST
URL to PDF
https://api.eu.apyhub.com/frolic/convert-webpage-to-pdf-file/url-to-pdf

QUICKSTART

GUIDE

Quickstart

Convert a web page to PDF by sending its URL as form data.

curl -X POST "https://api.eu.apyhub.com/frolic/convert-webpage-to-pdf-file/url-to-pdf" \
  -H "apy-token: $APY_TOKEN" \
  --data-urlencode "url=https://apyhub.com"

What you'll get back

Returns a binary PDF file (string with format: binary), not a JSON object.

TRY ITLIVE · 25 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body
Public http(s) URL of the page
Archival format: PDF/A-1b, PDF/A-2b or PDF/A-3b
A3, A4 (default), A5, A6, Letter, Legal or Tabloid
Landscape pages (default false)

About this endpoint

What it does

Converts a public HTTP(S) webpage URL into a PDF. You send the page URL in the request body, and the endpoint returns the generated PDF as a binary response.

Request Body

ParameterTypeMandatoryDescription
urlStringYesPublic http(s) URL of the page.
pdfaENUMNoArchival format. Allowed values: PDF/A-1b, PDF/A-2b, PDF/A-3b.
paperENUMNoPaper size. Allowed values: A3, A4 (default), A5, A6, Letter, Legal, Tabloid.
landscapeBooleanNoLandscape pages. Default: false.
margin_topNumberNoTop margin in inches. Range: 0-4. Default: 0.39.
wait_delayIntegerNoSeconds to wait after the page loads for JavaScript-heavy pages. Range: 0-10.
footer_htmlStringNoHTML repeated at the bottom of every page; uses the same placeholders as header_html.
header_htmlStringNoHTML repeated at the top of every page. <span class="pageNumber"></span> and <span class="totalPages"></span> are filled in.
margin_leftNumberNoLeft margin in inches. Range: 0-4. Default: 0.39.
margin_rightNumberNoRight margin in inches. Range: 0-4. Default: 0.39.
margin_bottomNumberNoBottom margin in inches. Range: 0-4. Default: 0.39.
print_backgroundBooleanNoPrint background colours and images. Default: true.

Response

Returns a binary response containing the generated PDF document. The output schema is a binary string, so the success response is the PDF file itself rather than a JSON object.

ParameterTypeMandatoryDescription
binaryStringYesPDF file content returned as binary data.
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.