apyhub
FILE CONVERSION

Convert HTML to PDF API

Hosted on ApyHub

What it does

HTML to PDF converts HTML files into PDF output from a remote URL, a base64-encoded payload, or a direct file upload. You can receive the result as a downloadable PDF binary or as a signed link, depending on the endpoint you use.

Send a url to convert remote HTML, or send base64 when your HTML is already encoded. For file-based workflows, upload file as binary. Several endpoints also accept a landscape boolean query parameter, and the download variants let you name the output with output.

Use HTML to PDF when you need to generate invoices, reports, receipts, archived snapshots, or printable web pages from existing HTML. The response is intentionally simple: download endpoints return PDF bytes, and link endpoints return a data URI pointing to the generated file.

Choose the form of delivery that fits your app: direct binary for immediate file handling, or a signed link when you want to store or share the generated PDF later.

▣ ENDPOINT 01 / 06
POST
Convert remote HTML file URL to PDF signed link
http://localhost:8080/apyhub/convert-html-to-pdf/url/link
QUICKSTARTGUIDE

Quickstart

Send the HTML page URL you want to convert to PDF.

curl -X POST "http://localhost:8080/apyhub/convert-html-to-pdf/url/link" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://assets.apyhub.com/samples/sample.html"}'

What you'll get back

Returns a JSON object with a data string field containing a URI for the generated PDF.

{
  "data": "https://example.com/generated.pdf"
}
TRY ITLIVE · 100 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*

About this endpoint

What it does

Converts a remote HTML file at the given URL into a PDF and returns a signed PDF link. The request sends the source url in the body, and the response returns the generated PDF link in a data string.

Request Body

ParameterTypeMandatoryDescription
urlStringYesRemote HTML file URL to convert to PDF. Must be a URI.

Response

Returns a JSON object with a data string field containing a URI to the generated PDF file. Success response: 200.

ParameterTypeMandatoryDescription
dataStringYesURI of the generated signed PDF link.

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 02 / 06
POST
Convert base64-encoded HTML file to PDF download
http://localhost:8080/apyhub/convert-html-to-pdf/base64/download
QUICKSTARTGUIDE

Quickstart

Convert base64-encoded HTML into a PDF download with a single JSON request.

curl -X POST "http://localhost:8080/apyhub/convert-html-to-pdf/base64/download" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"base64":"PGh0bWw+PGJvZHk+PGgxPkhlbGxvPC9oMT48L2JvZHk+PC9odG1sPg=="}'

What you'll get back

Returns a binary file response (string with format: binary), which is the generated PDF content.

(binary PDF data)
TRY ITLIVE · 100 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*
Base64-encoded file bytes.

About this endpoint

What it does

Converts a base64-encoded HTML file into a PDF and returns the PDF as a download. The request body must include the base64 input, and you can optionally set landscape as a query parameter.

Query Parameter(s)

AttributeTypeMandatoryDescription
landscapeBooleanNoDefault: false

Request Body

ParameterTypeMandatoryDescription
base64StringYesBase64-encoded file bytes.

Response

Returns a binary file response containing the generated PDF for download. The output schema is a binary string, so the success response body is the PDF content itself.

ParameterTypeMandatoryDescription
fileStringYesBinary PDF content returned as the response body.

Query parameters

Name
Type
Description
landscapeOPTIONAL
boolean
DEFAULT false

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 03 / 06
POST
Convert base64-encoded HTML file to PDF signed link
http://localhost:8080/apyhub/convert-html-to-pdf/base64/link
QUICKSTARTGUIDE

Quickstart

Convert a base64-encoded HTML file into a PDF link by sending the encoded bytes in the request body.

curl -X POST "http://localhost:8080/apyhub/convert-html-to-pdf/base64/link" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"base64":"PGh0bWw+PGJvZHk+SGVsbG8sIHBkZjwvYm9keT48L2h0bWw+"}'

What you'll get back

Returns a JSON object with a data string field containing the generated file URI.

{
  "data": "https://example.com/generated-file.pdf"
}
TRY ITLIVE · 100 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*
Base64-encoded file bytes.

About this endpoint

What it does

Converts a base64-encoded HTML file into a PDF and returns a signed link to the generated PDF. The request body must include the base64 file contents, and the response returns the resulting PDF URL in a JSON object.

Request Body

ParameterTypeMandatoryDescription
base64StringYesBase64-encoded file bytes.

Response

Returns a JSON object with a data string field formatted as a URI — this is the signed link to the generated PDF.

ParameterTypeMandatoryDescription
dataStringYesSigned PDF link as a URI.

Body

Name
Type
Description
bodyREQUIRED
object
▣ ENDPOINT 04 / 06
POST
Convert HTML file upload to PDF download
http://localhost:8080/apyhub/convert-html-to-pdf/file/download
QUICKSTARTGUIDE

Quickstart

Upload an HTML file to download the converted PDF.

curl -X POST "http://localhost:8080/apyhub/convert-html-to-pdf/file/download" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/file.html"

What you'll get back

Returns a binary file stream, which is the generated PDF document.

TRY ITLIVE · 100 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.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*
.html

About this endpoint

What it does

Uploads an HTML file and returns the generated PDF as a binary download.

Query Parameter(s)

AttributeTypeMandatoryDescription
outputStringNoOutput filename for the generated PDF. Example: output.pdf.
landscapeBooleanNoWhen true, generates the PDF in landscape orientation. Default: false.

Request Body

ParameterTypeMandatoryDescription
fileStringYesHTML file to convert. Binary upload; expected file type: .html.

Response

Returns a binary file containing the generated PDF.

Query parameters

Name
Type
Description
outputOPTIONAL
string
landscapeOPTIONAL
boolean
DEFAULT false

Body

Name
Type
Description
bodyREQUIRED
object

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 05 / 06
POST
Convert HTML file upload to PDF signed link
http://localhost:8080/apyhub/convert-html-to-pdf/file/link
QUICKSTARTGUIDE

Quickstart

Upload an HTML file and get back a PDF link; this example also sets the optional landscape query flag to false by omission.

curl -X POST "http://localhost:8080/apyhub/convert-html-to-pdf/file/link" \
  -H "apy-token: $APY_TOKEN" \
  -F "file=@/path/to/file.html"

What you'll get back

Returns a JSON object with a data string field containing a URI to the generated PDF.

{
  "data": "https://example.com/generated.pdf"
}
TRY ITLIVE · 100 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.
Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.
body*

About this endpoint

What it does

Converts an uploaded HTML file into a PDF and returns a signed link to the generated PDF. The request sends the file in the body, and the response returns a JSON object containing the PDF URL.

Query Parameter(s)

AttributeTypeMandatoryDescription
landscapeBooleanNoOptional page orientation flag. Default: false.

Request Body

ParameterTypeMandatoryDescription
fileStringYesHTML file to convert. Binary upload.

Response

Returns a JSON object with a data string field containing a URI for the generated PDF signed link.

ParameterTypeMandatoryDescription
dataStringYesURI of the generated PDF signed link.

Query parameters

Name
Type
Description
landscapeOPTIONAL
boolean
DEFAULT false

Body

Name
Type
Description
bodyREQUIRED
object

Max 100MB total per request (all files combined). Larger? Use this API's URL-based endpoint instead, if it has one.

▣ ENDPOINT 06 / 06
POST
Convert remote HTML file URL to PDF download
http://localhost:8080/apyhub/convert-html-to-pdf/url/download
QUICKSTARTGUIDE

Quickstart

Download a PDF from a webpage URL by sending the page link in the JSON body.

curl -X POST "http://localhost:8080/apyhub/convert-html-to-pdf/url/download" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://assets.apyhub.com/samples/sample.html"}'

What you'll get back

Returns a binary PDF file response.

TRY ITLIVE · 100 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*

About this endpoint

What it does

Converts a remote HTML file accessible by URL into a PDF download. The request accepts the source HTML URL in the body and can optionally set landscape orientation via a query parameter.

Query Parameter(s)

AttributeTypeMandatoryDescription
landscapeBooleanNoWhen true, generates the PDF in landscape orientation. Default: false.

Request Body

ParameterTypeMandatoryDescription
urlStringYesThe remote HTML file URL to convert. Must be a valid URI.

Response

Returns a binary PDF file as the response body. The output schema is a single string with binary format, so the success response is the downloadable PDF content rather than a JSON object.

ParameterTypeMandatoryDescription
response bodyStringYesBinary PDF data.

Query parameters

Name
Type
Description
landscapeOPTIONAL
boolean
DEFAULT false

Body

Name
Type
Description
bodyREQUIRED
object
▣ 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.