Generate a Blank PDF

This guide will take you through the process of generating a blank PDF using the PDF Generation feature.

Document Content

To generate a blank PDF, you can supply some HTML that renders as an empty page, like so:

<!DOCTYPE html>
<html>
</html>

PDF Generation

Next, send the above HTML to Document Engine for generation. Use the /api/documents(opens in a new tab) endpoint, sending the PDF Generation schema with the HTML file from above:

Terminal window
curl -X POST http://localhost:5000/api/documents \
-H 'Authorization: Token token=<API token>' \
-F document_id=blank-document \
-F generation='{ "html": "page.html" }' \
-F page.html=@/path/to/page.html

After performing the above curl command, you can view the generated document in the Server dashboard at http://localhost:5000/dashboard/documents/blank-document:

A blank PDF

Using the PDF Generation schema, you can control the page size you want to create. In this example, you create the page in letter size:

Terminal window
curl -X POST http://localhost:5000/api/documents \
-H 'Authorization: Token token=<API token>' \
-F document_id=blank-document \
-F generation='{ "html": "page.html", "layout": { "size": "Letter"} }' \
-F page.html=@/path/to/page.html