Documentation

Html2pdf API is a powerful API that allows you to convert HTML to PDF or PNG Screenshots in seconds. It is perfect for generating invoices, reports, and other documents from your web application. With Html2pdf API, you can easily convert any HTML content to a high-quality PDF or PNG image that you can download or save to your S3 bucket.

S3 bucket integration is optional and allows you to store the generated files directly in your S3 bucket. This feature is perfect for managing large volumes of documents and automating your document generation process. If do not have an S3 bucket, we will store the files for you for 7 days. After that, they will be automatically deleted.

Getting Started

Setting up the API is easy. Just create an account on the Html2pdf API website and generate one or more API keys. You can use these keys to authenticate your requests to the API and start converting HTML to PDF or IMAGE.

Each request to the API must include your POST payload as apiKey: '<API_KEY>'

You can decide to wait for the conversion to finish or set the payload `async` key to `false` or `true` and get the result later. In the Business plan and Enterprise plan you can also set a webhook to receive a notification when the conversion is finished.

To query the status of the conversion, you can use the GET: /api/render/:id endpoint.
This endpoint requires the id of the conversion and it will return the information about the conversion.
The status field will tell you if the conversion is still in progress or if it has finished. The available status values are <queue|processing|completed|failed>.

API Reference

Our API allows you to render web pages as images, PDFs, videos, or HTML. Below is the detailed API reference.

POST /api/render

Capture a web page as an image, PDF, video, or HTML.

Request Body

The request body must be a JSON object with the following properties:

GET /api/render/:id

Retrieve the status of a capture job using the GET method.

Query Parameters

The request must include the following query parameter:

  • id (string, required): ID of the capture job.

Roadmap

We are working hard to bring you new features and improvements. A clear roadmap has yet to be defined, because we are in the early stages of development and we are listening to our customers to understand what they need.
If you have any idea or suggestion, please let us know by sending a message to our support team.