Convert HTML to PDF#

This feature allows for the conversion of HTML code, HTML templates, or entire web pages (URLs) into PDF format. It’s designed to transform web content into a portable and universally accessible PDF format with ease.

Make Step

Input#

Name

Description

Required

Convert Options

Choose from HTML to PDF, HTML Template to PDF, or URL to PDF.

Yes


HTML to PDF#

Name

Description

Required

Input HTML Code

Provide the raw HTML code for conversion.

Yes


HTML Template to PDF#

Name

Description

Required

HTML Template ID

Enter the ID from HTML to PDF Templates.

No

Input data in CSV or JSON format

Supply data in CSV or JSON format for the selected HTML template. Examples: CSV: invoice_id, totalrn12345,$999 JSON: {"invoice_id":"12345","total":"$999"}. Test your HTML to PDF Templates.

Yes


URL to PDF#

Name

Description

Required

Input URL to web page

Enter the URL of the web page for conversion. Example: https://google.com.

Yes


Name

Description

Required

Output File Name

Specify a custom file name for the output file.

No

Orientation

Select the PDF orientation: Portrait or Landscape.

No

Paper Size

Choose the paper size, such as Legal, Letter, A0, A1, A2, A3, A4, A5, etc.

No

Render Page Background

Specify if the page background should be rendered in the PDF.

No

Do not wait for full load

Select if the conversion should proceed without waiting for the full page load.

No

Margins

Set custom margins, overriding CSS margin styles for the converted page.

No

Execution Mode

Select Sync for small tasks up to 10 seconds. Choose Async for standard jobs, or Async For Large Docs for tasks over 30 seconds. Use Job Check module for retrieving results in large tasks.

No

Profiles

Add custom options for the process in a JSON string format. See API Profiles for more details.

No

Output Links Expiration

Set the expiration time in minutes for output links. Default is 60 minutes. Increase this limit with a Business Plan or higher, see plans here for details.

No

Export Type

Choose between Download a File or JSON Output. Default is Download a File.

No


Output#

Name

Description

url

This is the temporary URL provided by the PDF.co file server.

Data

Represents the output binary data. This data is generated only when the Export Type option is set to Download a File.

Status

Indicates the response status code. A success status is returned if the operation is successful.

Page Count

The total number of pages in the output PDF.

outputLinkValidTill

Specifies the timestamp until which the url remains accessible.

error

Provides details about any errors encountered during the process, if applicable.

name

The designated name of the output file.

Job Id

A unique identifier assigned to the job.

credits

The amount of credits utilized for the process.

Remaining Credits

Displays the balance of credits available in your account.

duration

The duration of time the process took to complete.