DocRaptor HTML TO PDF API

How to create a PDF with a QR Code

QR codes are simply an image, and embedding images in a DocRaptor PDF is just normal HTML:

<img src="https://docraptor-production-cdn.s3.amazonaws.com/tutorials/qr-code.png" />

Unfortunately, we can't help you generate the actual QR codes. For that, you'll need one of the many QR code generator APIs available. All of them should return an QR image that you can insert into your HTML.

To see how this QR code document is turned into a PDF, see below for full source code examples of DocRaptor's HTML-to-PDF API.

Select Your Language

Using DocRaptor's API

Below are the basics of using DocRaptor's HTTP API. It can easily be used in any programming language, but if we don't have a native agent for your language, please let us know! That'll help us write the best examples and agents.

The API key shown here, YOUR_API_KEY_HERE, actually works! Use it for testing without creating an account. The only requirement is test mode must be used (test parameter set to true).

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

https://YOUR_API_KEY_HERE@api.docraptor.com/docs

Send JSON-encoded API parameters (you'll need to set an HTTP header for Content-Type as application/json). These are the only required parameters:

{
  "type": "pdf",
  "document_content": "Hello World!"
}

Generating the Document with cURL

Here's a completely functional code sample for this tutorial:

cat <<-'DOCUMENT_OPTIONS' > docraptor_parameters.json
  {
    "test": true,
    "document_type": "pdf",
    "document_content": "<img src=\"https://docraptor-production-cdn.s3.amazonaws.com/tutorials/qr-code.png\" />"
  }
DOCUMENT_OPTIONS

curl https://YOUR_API_KEY_HERE@api.docraptor.com/docs \
  --fail --silent --show-error \
  --header "Content-Type:application/json" \
  --data @docraptor_parameters.json \
  > qr-code.pdf

Downloads

Here are all the files you need to follow this tutorial:

Related Tutorials & Documentation

See the complete PDF tutorial list or review the documentation for additional info, such as generating asynchronous documents.

Ready to get started? Try DocRaptor for free with unlimited test documents.