Structured data in QR codes
Several of our API endpoints can add barcodes as a watermark or overlay to your PDFs (e.g. the add/barcode
-endpoint here). QR codes can be particularly useful as they are widely accepted and can be scanned with any recent smartphone. The most common use case is simply putting a URL or web address into the code, but many other applications are possible.
While the interpretation of a QR code's content (or 'payload') is not formally standardized, a number of pseudo-standards have been introduced over the past ten years or so. The following sections introduce the most common content types of QR codes.
QR Code with Webaddress or URL
Encoding a URL is by far the most common use case. The barcode can then be added to letters, reports, flyers and similar PDF documents. When scanned with a smartphone camera, the link to the web address is detected and the camera app will offer to open the respective website in a browser.
The URL can be encoded directly into the code, e.g. https://www.example.com
, special formatting is not required.
Sample code https://pdfteam.com
:
Things to consider:
• Always supply the http:// or https:// header with the URL
• Longer URLs mean a larger code; you can also encode shortened URLs, e.g from bitly
• URLs with parameters must be properly escaped, e.g. a space must be encoded as %20
QR code with link to an Instagram account
To link to your Instagram account, append your Instagram user name to the URL like so:
https://instagram.com/username
QR code with link to a Twitter account
To link to your Twitter account, append your Twitter handle to the URL like so:
https://twitter.com/handle
Note: Do not put in "@" or "#" characters.
QR code with Facetime link
Not strictly a URL but you can also put a link to Facetime Video in a QR code like so:
facetime:+18005551234
QR Code with a phone number or SMS number
Another popular application is encoding a phone or SMS number into the code. Here a phone number has to be prepended by the protocol snippets tel:
, an SMS no. by sms:
so that scanners or scanner apps can interpret the content correctly.
Example:
tel:+18005551234
sms:+18005551234
With SMS numbers it's also possible to put the actual message into the code, example:
sms:+18005551234?body=Hello
Things to consider:
• Always supply the country code with a leading "+", e.g. "+1" or "+001" for the USA
• For the number, do not enter spaces, blanks, parentheses or hyphens, just the actual digits
• Do not enter vanity numbers, e.g. "+1-800-FLOWERS"; those won't be encoded correctly
QR Code with an email address
Finally, QRs can encode email addresses and bodies. This application is not that common because the codes can get very large with longer messages. In principle, emails work like the SMS scheme described above, the difference is the protocol snippet which ist mailto:
instead of sms:
mailto:someone@example.com?body=Hello
Further reading
List of common payloads (Github)
Encoding WiFi access data (Softmatic)