Getting Started


Code Examples


Not using any of our example languages? Here are the basics, but let us know what you're using! That'll help us get the best examples.

Make a POST...

To make docs, send a POST request to this URL:

...with this payload

Here's an example POST body payload in JSON. Note that when sending JSON, you'll need to set an HTTP header for Content-Type as application/json.

  "test": true,                                                    // test documents are free but watermarked
  "document_content": "<html><body>Hello</body></html>",           // supply content directly
  // "document_url": "", // or use a url
  "name": "docraptor.pdf",                                         // help you find a document later
  "document_type": "pdf",                                          // pdf or xls or xlsx
  // "javascript": true,                                           // enable JavaScript processing
  // "prince_options": {
  //   "media": "screen"                                           // use screen styles instead of print styles
  //   "baseurl": ""                               // pretend URL when using document_content
  // }


Here's how to do it with curl:

curl \
  --fail --silent --show-error \
  --header "Content-Type:application/json" \
  --data '{"test": true,
           "document_url": "",
           "name": "docraptor.pdf",
           "document_type": "pdf" }' > docraptor.pdf

Converting HTML into PDF and XLS documents is fast and painless with DocRaptor. 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 you’ll find complete examples for many programming languages, but our API Reference Guide has all the details about the complete workings of the Docs API.

Circledoc@2x b7190ebc358a17e69dbca79130e38cbd308c3fd4e6c17e5eaf2538c18c1c06d3

With DocRaptor, your PDF content is HTML and its style is CSS - things you already know! Even still, it can be difficult to get your PDF to look just right. Check out our Style and Formatting Documentation for everything related getting a perfectly styled PDF!