Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
    
This question might be of some help. The answers seem to use pstricks though. –  TH. Feb 8 '11 at 11:37
1  
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
add comment

3 Answers

up vote 12 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}
share|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
3  
@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
1  
@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

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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