Documentation
Getting Started
Code Examples
Not using any of the above languages? It's still easy to use DocRaptor's HTML to PDF API with basic HTTP calls.
Make a POST request
To convert a document, simply send a POST request to https://YOUR_API_KEY_HERE@docraptor.com/docs
with the below JSON payload:
{
"test": true, // test documents are free but watermarked
"document_content": "<html><body>Hello</body></html>", // supply content directly
// "document_url": "http://docraptor.com/examples/invoice.html", // or use a url
"type": "pdf", // pdf or xls or xlsx
// "javascript": true, // enable JavaScript processing
// "prince_options": {
// "media": "screen" // use screen styles instead of print styles
// "baseurl": "http://hello.com" // pretend URL when using document_content
// }
}
For more information, see our complete API reference.
curl
Here's an example of that POST request with curl:
curl http://YOUR_API_KEY_HERE@docraptor.com/docs \
--fail --silent --show-error \
--header "Content-Type:application/json" \
--data '{"test": true,
"document_url": "http://docraptor.com/examples/invoice.html",
"type": "pdf" }' > docraptor.pdf
Next Steps
- Optionally store and get a URL for your converted document with PDF document hosting
- Perfect your PDF styling with our knowledge base and style and formatting reference. Easily add headers and footers, page breaks, page numbers, table of contents, and much more!
With DocRaptor, it's fast and painless to convert HTML, CSS, and JavaScript into PDF and XLS documents. Just POST to our Docs API with your HTML content and some required parameters, either as a form serialized string or a JSON object.
Below are working code examples for creating documents. Our API reference lists all the generation options and our style and formatting guide will help make it look perfect.