API Documentation

API Documentation
HTML to PDF generation API

Give Me PDF provides single endpoint to convert your HTML to PDF.

Creating PDF

Send POST request to https://givemepdf.com/api/v1/pdf/create endpoint to generate PDF.

Authentication

All API call to create PDF from HTML must have API-KEY parameter on its header.

Request Body

All request must be a form-data and should have parameter body whose value must contain your HTML code which will be converted to PDF.

You can also pass optional parameter document_name with maximum character limit of 60. You can use this parameter to easily identify your document.

For PDF orientation, application will use portrait by default but if you want your PDF in landscape mode, use orientation parameter with value landscape.

Parameter name Accepted Value Required
body HTML code or plain text Yes
document_name String with maximum of 60 No
orientation Valid value includes portrait (default) or landscape No
Response

If HTML to PDF conversion was successful, you will receive JSON response with status code 200 containing link to download generated PDF. Sample response can be found below.

{
    "message": "OK",
    "data": {
        "location": "https://givemepdf.com/storage/8b6293cb05ee815c/ossrPslsisxeRLp0.pdf",
        "warning": "This file is available for limited time. Please download as soon as possible."
    }
}
Possible errors
Error Message Solution
401 Unauthorized API-KEY missing Make sure that your request header has API-KEY header with value.
401 Unauthorized Invalid API Key Your API key is either wrong or is inactive. Login to your dashboard to get valid API key or generate new one.
429 Too Many Requests You have hit your account per minute request limit We only allow 4 requests per minute. You have exceeded this limit
429 Too Many Requests Monthly limit of x requests used up We only allow fixed number of requests per month. You have reached this limit. Your quota will be reset next month.
422 Unprocessable Entity Missing body parameter in request Your form-data is missing body parameter in request.
422 Unprocessable Entity Missing HTML content for PDF generation Your form-data has body parameter but its value is empty. You should send HTML content in this parameter.
422 Unprocessable Entity Missing HTML content for PDF generation Your form-data has body parameter but its value is empty. You should send HTML content in this parameter.
500 Internal Server Error PDF creation error Something went wrong while creating PDF from HTML. Please refer to our troubleshooting section for more detail. If all troubleshooting measures fail, contact use here.
Troubleshooting
  • Make sure that you use basic HTML tags. Give me PDF uses wkhtmltopdf and anything that is not compatible with this tool will throw error.
  • Always try to use absolute path for images as its impossible to get images from relative path.
    Example use <img src="https://example.com/images/cat.jpg"> and not <img src="/images/cat.jpg"> Same applies for other assets like CSS.
  • If your have to use relative path in HTML, don't forget to add base tag on head tag.
    <base href="https://www.example.com/">
  • If you have trouble with rendering Unicode characters, please add proper meta tag on header.
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    If you still have problem with unicode rendering please contact us about the language you are trying to render.