Overview
Give Me PDF offers two API endpoints for converting HTML to PDF. This page covers the PDF Render endpoint.
Rendering a PDF
Send a POST request to the following endpoint to generate a PDF:
POST https://www.givemepdf.com/api/v1/pdf/render
This endpoint supports advanced, modern CSS features, making it the right choice for complex layouts. For simple HTML and CSS, use PDF Create.
Credits required: 3 / request
Authentication
Every API call must include an API-KEY header.
You can find your API key in your dashboard.
Request body
Requests must be sent as form-data and include a body parameter containing the HTML you want to convert.
You can also pass an optional document_name parameter (up to 60 characters) to help you identify your document.
PDFs use portrait orientation by default. For landscape, set the orientation parameter to landscape.
| Parameter | Accepted value | Required |
|---|---|---|
body |
HTML code or plain text | Yes |
document_name |
String, up to 60 characters | No |
orientation |
portrait (default) or landscape |
No |
scale |
A number between 0.1 and 2.0 |
No (default: 0.75) |
format |
Letter, Legal, Tabloid, Ledger, A0, A1, A2, A3, A4, A5, A6 |
No (default: A4) Other formats are available to Pro users. |
Response
When the conversion succeeds, you will receive a JSON response with status code 200 and a link to download your PDF. Here is a sample response:
{
"message": "OK",
"data": {
"location": "https://givemepdf.com/storage/8b6293cb05ee815c/ossrPslsisxeRLp0.pdf",
"file_ttl_days": 1,
"warning": "This file is available for limited time. Please download as soon as possible."
},
"meta": {
"remaining_free_credit": 3470,
"remaining_paid_credit": 10000
}
}
Possible errors
| Status | Message | How to fix it |
|---|---|---|
401 Unauthorized |
API-KEY missing | Make sure your request includes the API-KEY header with a value. |
401 Unauthorized |
Invalid API Key | Your API key is incorrect, expired or revoked. Sign in to your dashboard to copy a valid key or generate a new one. |
429 Too Many Requests |
You have hit your account per minute request limit | Each plan allows a limited number of requests per minute. Please wait a moment and try again. |
429 Too Many Requests |
Monthly limit of x requests used up | Free accounts include a fixed number of requests each month, and you have reached it. Your quota resets next month — Pro users do not have monthly limits. |
422 Unprocessable Entity |
Missing body parameter in request | Your form-data request is missing the body parameter. |
422 Unprocessable Entity |
Missing HTML content for PDF generation | Your request includes the body parameter, but it is empty. Send your HTML content in this parameter. |
500 Internal Server Error |
PDF creation error | Something went wrong while creating your PDF. Please check the troubleshooting tips below. If the problem persists, contact us. Contact us |
Troubleshooting
- You can use JavaScript, since Give Me PDF uses Puppeteer under the hood. However, JavaScript errors in your HTML may prevent the PDF from being created or break its design.
-
Always use absolute paths for images, because assets cannot be loaded from relative paths. For example, use
<img src="https://example.com/images/cat.jpg">instead of<img src="/images/cat.jpg">. The same applies to other assets, such as CSS files. -
If you need relative paths in your HTML, add a
basetag inside yourheadtag:<base href="https://www.example.com/"> -
If Unicode characters are not rendering correctly, add the following meta tag to your head:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">Still having trouble? Contact us and let us know which language you are trying to render.