# How to dimensions in mm of barcodes/qrcodes generated with pst-barcode for sticky labels - i.e. when using labels package?

How to specify dimensions of barcode in mm ? (when using pst-barcode and labels packages)

scalex,scaley seems to work. Why not absolute dimensions specifications ?

\documentclass[a4paper,12pt]{article}
\usepackage[newdimens]{labels}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf} % require -shell-escape
\LabelCols=4%
\LabelRows=11%
\LeftPageMargin=7mm%
\RightPageMargin=7mm%
\TopPageMargin=15mm%
\BottomPageMargin=2mm%
\InterLabelColumn=0mm%
\InterLabelRow=0mm%
% These four parameters give the extra space used around the text on
% each actual label.
\LeftLabelBorder=4mm%
\RightLabelBorder=4mm%
\TopLabelBorder=4mm%
\BottomLabelBorder=4mm%
\begin{document}

% Specification of 4mm x 4mm seems not respected
\numberoflabels=4
\begin{pspicture}(4,4mm)
\psbarcode{38}{includetext guardwhitespace}{ean2}
%\psbarcode[scalex=0.2,scaley=0.2]{38}{includetext guardwhitespace}{ean2}
\end{pspicture}
}

% Specification of 0.1in x 0.1in seems not respected
\numberoflabels=4
\begin{pspicture}(0.1,0.1in)
\psbarcode{38}{includetext guardwhitespace}{ean2}
%\psbarcode[scalex=0.2,scaley=0.2]{38}{includetext guardwhitespace}{ean2}
\end{pspicture}
}

% but scalex, scaley seems respected
\numberoflabels=36
\begin{pspicture}
\psbarcode[scalex=0.1,scaley=0.1]{38}{includetext guardwhitespace}{ean2}
\end{pspicture}
}

\end{document}


Command line

pdflatex -shell-escape input.tex


Notes:

If mm are not possible or overcomplicate code, let it be in in.

\begin{pspicture}(0.1,0.1in) makes no sense. Without a unit or a preceding \psset{unit=1in} it is always cm. Same for \begin{pspicture}(4,4mm). You have to specify both units if not the default one:

\documentclass[a4paper,12pt]{article}
\usepackage[newdimens]{labels}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf} % require -shell-escape
\LabelCols=4%
\LabelRows=11%
\LeftPageMargin=7mm%
\RightPageMargin=7mm%
\TopPageMargin=15mm%
\BottomPageMargin=2mm%
\InterLabelColumn=0mm%
\InterLabelRow=0mm%
% These four parameters give the extra space used around the text on
% each actual label.
\LeftLabelBorder=4mm%
\RightLabelBorder=4mm%
\TopLabelBorder=4mm%
\BottomLabelBorder=4mm%
\begin{document}
\numberoflabels=4
\begin{pspicture}(4mm,4mm)
\psbarcode{38}{height=0.158 includetext guardwhitespace}{ean2}
\end{pspicture}%
}

\numberoflabels=4

height= and width= are used on PostScript level and are always in the unit inch. 4mm=4/25.3 in=0.158in
scalex and scaley are used on TeX level.
• Thanks a lot! Now it works! Btw. (1,1in) kind of artifacts come from dumb copy&pasting of pst-barcode-doc.pdf manual. Jan 24 '16 at 12:47