Generating barcodes and QR codes with LaTeX

Slashdot it! Delicious Share on Facebook Tweet! Digg!

Easy to Contact

QR codes are increasing found on business cards. This makes it easy to read and save contact information in an address book. You will find an example of the relevant LaTeX code in Listing 6.

Listing 6

QR Business Card

&&nonumber
01 \obeylines
02 \psbarcode{
03 BEGIN:VCARD^^J
04 VERSION:4.0^^J
05 N:Mustermann;Max;;^^J
06 FN:Max Mustermann^^J
07 ADR;TYPE=home:;;Hauptstr. 42;Musterstadt;;12345;Germany^^J
08 TEL;TYPE=home:+49123456789^^J
09 TEL;TYPE=cell:+49170123456789^^J
10 EMAIL:max.mustermann@example.com^^J
11 URL:http://www.example.com^^J
12 END:VCARD^^J}{}{qrcode}
13 \rput(2.15,2.2){\includegraphics{postkarte.eps}}

This time the psbarcode command contains the value for the contents of a VCard file in the first set of curly braces (lines 2 to 12). Here you must ensure that every entry in the VCard occurs on its own line. For LaTeX to make line breaks correctly, the command has to include obeylines (line 1). Additionally, you will have to specify the ends of the lines with the sequence ^^J .

QR codes have built-in error correction. Even when the scanner is unable to read a larger or smaller part of the QR code, the code can still be decrypted. This property can be used to insert a picture into the QR code. Therefore, you can add things like a photo, a logo or even an icon with a postcard as shown to the far right in the example in Figure 2.

The command from the PSTricks package in line 13 places the contents of the image file given in the set of curly braces at the coordinates specified in the parentheses. For this command to function, you will also need to add the package graphicx [7]>>8 in the preamble. Although the image now covers up a portion of the QR code, the contact information is still readable provided the photo is not too large.

Conclusion

Bar and QR codes are all around us and they provide many opportunities to quickly and conveniently read and process all different kinds of information using a smartphone or a tablet. Pst-barcode lets you create high-quality barcodes and QR codes on your own.

Buy this article as PDF

Express-Checkout as PDF

Pages: 3

Price $0.99
(incl. VAT)

Buy Ubuntu User

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Online LaTeX Editors

    You can edit your LaTeX documents with online editors that run across platforms and are device independent. Documents get saved online, thus giving you and other members of a work group easy access from anywhere.

  • Fine-tuning LaTeX documents

    Proofreading, wordsmithing, and finalizing the layout are all steps in the final editing phase of a document. LaTeX used with additional software can help you master these steps.

  • Creating vector graphics with LaTeX and TikZ

    Using LaTeX and the TikZ package, you can create high-quality vector graphics to improve your documents by making them more visually appealing.

  • Minimizing load time for web pages

    Web page loading time relies on a complex interplay among the web server, the web page, and the web browser. Learning a few tricks can help speed up load times for the pages you create.

  • Software for scientific texts

    Scientific documents are where open source tools show their greatest strengths. To save yourself a lot of trouble, however, you need to know how to combine formulas and data into your work. Linux provides the appropriate tools.