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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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?


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.


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


This issue is resolved in pst-barcode 0.14.

share|improve this question
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
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

PSTricks always creates vector orientated graphics. With




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? – kiss my armpit Jul 10 '12 at 10:22
@loomi: you should write to the barcodewriter mailing list, see code.google.com/p/postscriptbarcode – Herbert Jul 10 '12 at 11:21
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


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.