API Documentation: HTML to PDF API
Introduction:
The HTML to PDF API provided by Wrab Tech allows developers to convert HTML content into PDF documents programmatically. This API provides a convenient way to generate high-quality PDF files from HTML code, making it suitable for a variety of applications such as generating invoices, reports, or printable documents.
Base URL:
The base URL for accessing the HTML to PDF API is: https://api.wrabtech.com/pdf
Authentication:
To access the API, you need to include your API key in the request headers. The API key can be obtained by signing up for an account on Wrab Tech's website.
Supported Methods:
The API supports the following HTTP methods:
POST /convert
- Description: Converts HTML content to a PDF document.
- Request Headers:
- Content-Type: application/json
- Authorization: Bearer {your-api-key}
- Request Body:
- url of html page: The HTML content to be converted (required).
- Response:
- Content-Type: application/pdf
- Body: The PDF file as a binary response.
Conversion Options:
The options parameter in the request body allows you to specify additional settings for the PDF conversion. The following options are available:
- 1. pageSize: The size of the PDF page. Supported values: A4, Letter, Legal, etc. Default: A4.
- 2. margin: The margin size around the content in CSS units. Default: '1cm'.
- 3. header: HTML content for the PDF header section (appears on each page). Default: None.
- 4. footer: HTML content for the PDF footer section (appears on each page). Default: None.
Example Usage:
To convert an HTML page to a PDF document click here
Response:
If the conversion is successful, the API will respond with a 200 OK status code and return the PDF document as the response body.
Error Handling:
In case of any errors, the API will respond with an appropriate HTTP status code along with an error message in the response body, providing information about the encountered issue.