TL;DR-
Works
\psbarcode{NODATA}{height=0.33 width=1.6 includecheck includetext}{code128}
But "parametrized", does not work as expected (produces big transparent output)
\def\h{0.33}
\def\w{1.6}
\psbarcode{NODATA}{height=\h width=\w includecheck includetext}{code128}
Reason: I'd love to allow user to specify those \h and \w as parameter on commandline following this solution.
To be more specific
Given : nodata.tex
\documentclass{standalone}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf} % pdflatex require -shell-escape option!!!
\begin{document}
\begin{pspicture}
\psbarcode{NODATA}{height=0.33 width=1.6 includecheck includetext}{code128}
\end{pspicture}
\end{document}
with
$ pdflatex -shell-escape nodata.tex && convert -density 300x300 nodata.{pdf,png} && display nodata.png
generated properly nodata.pdf and nodata.png:
However when I change psbarcode parameters to use \h \w, i.e. \psbarcode{NODATA}{height=\h width=\w includecheck includetext}{code128} it stops rendering, and results in big transparent output. Full working differently then expected code:
\documentclass{standalone}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf} % pdflatex require -shell-escape option!!!
\begin{document}
\begin{pspicture}
\def\h{0.33}
\def\w{1.6}
\def\d{DATA}
\psbarcode{\d}{height=\h width=\w includecheck includetext}{code128}
\end{pspicture}
\end{document}
Rendering same but smaller resolution (30x30), as it results big:
$ pdflatex -shell-escape nodata.tex && convert -density 30x30 nodata.{pdf,png} && display nodata.png
Big transparent output, for completeness:




\def? – Grzegorz Wierzowiecki May 09 '16 at 22:18\newcommand\barcode[2]{\psbarcode{NODATA}{height=#1 width=#2 includecheck includetext}{code128}}? – May 09 '16 at 23:24\def\Key{Val}way? Still, giving ability to name parameters in "key1=val1,key2=val2" manner, has still some advantages. In my case I'd like to allow multiple optional arguments for tex template. – Grzegorz Wierzowiecki May 10 '16 at 05:41