Is there any package that generates 2d barcodes (QR code). I want to add a barcode on the front page of a manual I have written containing the URL where to download that manual. It would be nice if I could continue using pdflatex. Instead of converting each time.

EDIT: [Reaction to Jake's answer]

Is it possible one could only add one barcode. I've analyzed how this works. I think the compiler runs two times, one time rendering the pstricks images. A second time inserting the images in the LaTeX pdf. However if I add two different barcodes. It simply overides the file by the last barcode, and uses this file for both the barcodes. Is there any workaround for this problem?

link|improve this question

This question might be of some help. The answers seem to use pstricks though. – TH. Feb 8 '11 at 11:37
Indeed, but there it only compiles to .ps files. Of course one could write a simple bash script always converting the .ps file to a .pdf, but I was looking for a more elegant solution. – CommuSoft Feb 8 '11 at 11:48
1  
If you include the package auto-pst-pdf, you don't need to go through the conversion step. See my answer. – Jake Feb 8 '11 at 11:52
1  
run it with xetex and you do not need the auto-pst-pdf package – Herbert Feb 8 '11 at 12:39
feedback

3 Answers

up vote 8 down vote accepted

This will work directly with pdflatex:

\documentclass{article}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf}
\begin{document}
  \begin{pspicture}(0.7in,0.7in)
    \psbarcode{http://www.ctan.org}{}{qrcode}
  \end{pspicture}
\end{document}
link|improve this answer
Using this solution results in compiling without errors, but also without barcode. Is there perhaps a potential conflict between one of those packages? babel, amsmath, fullpage, amssymb, amsfonts, index, textcomp, graphicx, tikz, algorithm, algorithmic, wasysym, subfigure? – CommuSoft Feb 8 '11 at 11:55
1  
@CommuSoft: You need to run pdflatex with the -shell-escapre option, so that auto-pst-pdf can run the postscript tools. – Martin Scharrer Feb 8 '11 at 12:01
@CommuSoft: I don't have most of those packages installed on my system, so I don't know if there's a conflict. Try commenting the \usepackage lines one after the other until you find the offending package. – Jake Feb 8 '11 at 12:10
@martin Scharrer: that indeed did the job. The option to activate was --shell-escape (Linux/Ubuntu 10.10). Thanks. @Jake: I've try to find a conflict but none found. – CommuSoft Feb 8 '11 at 12:18
2  
The correct bounding box size is (0.7in,0.7in). the bar code has this default size. – Herbert Feb 8 '11 at 12:44
show 6 more comments
feedback

Take a look at »Typesetting Barcode« in the TeX Catalogue Online. It lists some useful packages

link|improve this answer
feedback

Two barcode side by side, run with pdflatex -shell-escape <file>

\documentclass{minimal}
\usepackage[pdf]{pstricks}
\usepackage{pst-barcode}
\begin{document}

\begin{pspicture}(0.7in,0.7in)
\psbarcode{ctan.org}{}{qrcode}
\end{pspicture}
%
\begin{pspicture}(0.7in,0.7in)
\psbarcode{tug.org}{}{qrcode}
\end{pspicture}

\end{document}

enter image description here

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.