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.

The pst-barcode package is great to produce bar-codes in all flavors.

And it does 1d bar-codes like a charm. Also it is capable of generating 2d bar-codes with a command like this for a qrcode:

  \begin{pspicture}(0.6cm,0.6cm)
    \psbarcode{http://example.org}{eclevel=L}{qrcode}
  \end{pspicture}

Which renders into something like this

enter image description here

But unfortunately all 2d codes are generated as bitmaps images. And depending on your viewer the end product gets fuzzy borders as the example shows.

Is there a way to create real vector graphics like the 1d bar-codes are generated?


UPDATE

It is true that the aliasing of the 2d codes is only a problem in some viewers and nevertheless it is printed correctly. The problem comes from the underlying postscript code which generates the 2d codes as an image in postscript. It should be possible to generate 2d codes also by using paths like the MaxiCode implementation. The underlying code is currently being updated.

UPDATE

Indeed, since Barcode Writer in Pure PostScript version 2014-01-06 the library generates 2D barcodes using filled paths as described in this answer.

share|improve this question
5  
that is a problem with your viewer and not PSTricks. You have the wrong setting. –  Herbert Jul 10 '12 at 9:30
    
The example is from Preview on Mac OS X. Sure the aliasing comes from the viewer. This is normal for bitmap images. What I are looking for is a vector representation of the barcode. The other barcodes render nicely in all viewers. (What has to be possible also for qrcodes.) –  loomi Jul 10 '12 at 9:54
    
If I look at the generated image with Preview or Skim the blurring is there; not if I use xpdf. –  egreg Jul 10 '12 at 10:04
1  
possible duplicate of Deactivating Anti-Aliasing when typesetting QR-Code –  Jake Jul 10 '12 at 10:25
    
@Jake Yes it is kind of a duplicate. Just that with pictures you have no chance to push the viewer not to use aliasing. In this case for QR-Codes it should be possible to draw this code in a way it will look sharp also in viewer which do aliasing of images. –  loomi Jul 10 '12 at 10:59

1 Answer 1

PSTricks always creates vector orientated graphics. With

\documentclass{article}
\usepackage{auto-pst-pdf,pst-barcode}
\begin{document}

\begin{pspicture}(1in,1in)
    \psbarcode{http://example.org}{eclevel=L}{qrcode}
\end{pspicture}

\end{document}

and running pdflatex -shell-escape <file> I'll get

enter image description here

The same is possible with xelatex whithout package auto-pst-pdf or with latex->dvips->ps2pdf

share|improve this answer
    
Hmm my TeXShop uses pdflatex --file-line-error --shell-escape --synctex=1 so i think the problem is somewhere else? Also the official pst-barcode documentation has the 2d bar-codes not as vector graphic included. Can you attach the pdf? –  loomi Jul 10 '12 at 9:58
    
the barcode is created as a matrix and your viewer thinks it is a bitmap image. Acrobat, okular, xpdf have no problem. –  Herbert Jul 10 '12 at 10:10
    
How do you know that 0.6cm is the exact value? –  cyanide-based food Jul 10 '12 at 10:22
2  
@loomi: you should write to the barcodewriter mailing list, see code.google.com/p/postscriptbarcode –  Herbert Jul 10 '12 at 11:21
1  
True, I have neither the experience nor the time to do this change. If there is a PostScript speaking person reading this, the task would be to change the code from using imagemask to using paths. The author Terry Burton would have some pointers where to start. Basically you have to rewrite the /renmatrix to take a bunch of pixels and draw them one by on. –  loomi Jul 10 '12 at 18:20

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.