8

I want to add a text to the QR-Code. I want a small numbers in one of the four black squares.

\documentclass[a4paper, 12pt, parskip]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf}

\begin{document}
  \section{Demo}
  \begin{pspicture}(1.378in, 1.5in)
    \psbarcode[]{1}{height=1.378 width=1.378}{qrcode}
    {\color{white}1}
  \end{pspicture}
  \begin{pspicture}(1.378in, 1.5in)
    \psbarcode[]{2}{height=1.378 width=1.378}{qrcode}
    {\color{white}2}
  \end{pspicture}
\end{document}

I tried textpos with no success. Has somebody other ideas?

rekire
  • 1,454

1 Answers1

12

You can use \rput(<x>,<y>){<stuff>} to place <stuff> at coordinates (<x>,<y>):

enter image description here

\documentclass[a4paper, 12pt, parskip]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage{pst-barcode}
\usepackage{auto-pst-pdf}

\begin{document}
  \begin{pspicture}(1.378in, 1.5in)
    \psbarcode[]{1}{height=1.378 width=1.378}{qrcode}
    {\psset{unit=1.378in}\rput(0.165,0.165){\color{white}1}}
  \end{pspicture}
  \begin{pspicture}(1.378in, 1.5in)
    \psbarcode[]{2}{height=1.378 width=1.378}{qrcode}
    {\psset{unit=1.378in}\rput(0.835,0.835){\color{white}2}}
  \end{pspicture}
  \begin{pspicture}(1.378in, 1.5in)
    \psbarcode[]{2}{height=1.378 width=1.378}{qrcode}
    {\psset{unit=1.378in}\rput(0.165,0.835){\color{white}3}}
  \end{pspicture}
\end{document}​

I've used \psset{unit=1.378in} (short for \psset{xunit=1.378in,yunit=1.378in}) to make each <x> and <y> unit be equivalent to 1.378in. That way, if you use 0, you're at the left-most/bottom of the QR code, and 1 will bring you to the right-most/top of the QR code, since the QR code is square.

Werner
  • 603,163