Unrecommended way
I would like to share my solution for historical purposes only and as a new version of postscriptbarcode is not a part of the TeX distributions, yet (April 2014). The presented solution in this question works well for me.
I don't want to scare you, especially TeX beginners, but from time to time you might face a serious deadline even when working with TeX. It happened to me in November 2013 when a Mac OS X user complained about barcode preview in PDF and I had two hours to fix it before production and making PDF file publicly available. I needed solution fast and a working one on Windows, Linux and Mac OS X. I was permitted by publisher to use any (dirty) trick.
At that time I found patch for diff but I didn't tested that as there were so many different releases of this project. The official release solving the issue didn't exist at that time. I was thinking to convert the PDF file somehow. I tried Inkscape with no desired success. I had no time for pstoedit experiments.
As a FontForge user I started to think about raster to vector conversion. There are several projects, two major ones are autotrace and potrace. I installed them and started reading documentation followed by my first experiments.
Let me make this story short, I am presenting you a solution right away with GraphicsMagick + autotrace, where:
- I get PDF version from
pst-barcode the usual way (auto-pst-pdf).
- I convert the temporary file to raster (GraphicsMagick, ImageMagick).
- I trace the result to a vector format with no background (autotrace). That blue color is set from within TeX to check that there is no white color or other background color. The key value is
-corner-surround 1 which helps to find 90 degree corners.
- I include the result back to the main TeX file if such a result exists (
\IfFileExists).
The presented solution works for one page/barcode only, it would require additional setup for a temporary PDF file with more pages/barcodes. In addition to that, it would be possible to do such a conversion on-the-fly (\write18). As I am using primarily 90 degree corners, it may not work for other barcode types.
I run these commands (it works with pdf-, xe- and lualatex; TeX Live):
lualatex --shell-escape mal-qrcode.tex
gm convert mal-qrcode-pics.pdf mal-qrcode-pics.bmp
autotrace -output-format pdf -output-file pst-qr.pdf -corner-surround 1 -background-color FFFFFF mal-qrcode-pics.bmp
pdfcrop --hires --margins 0 pst-qr.pdf mal-qrcode-pics-vector.pdf
lualatex --shell-escape mal-qrcode.tex
I enclose the TeX file (mal-qrcode.tex) and a preview of the result in a web browser (Firefox using pdf.js). Picture on left introduces the problem, picture on right shows the solution.
%! *latex mal-qrcode.tex
% with shell escape on
\documentclass[a4paper]{article}
\pagestyle{empty}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf}
\pagecolor{blue}
\begin{document}
\def\malfile{mal-qrcode-pics-vector.pdf}
\begin{pspicture}(0.7in,0.7in)
\psbarcode{01234567890}{eclevel=L}{qrcode}
\end{pspicture}
\IfFileExists{\malfile}{\includegraphics{\malfile}}{%
% The pspicture environment goes here if we want permanent replacement...
}% End of \IfFileExists...
\end{document}
