Take the 2-minute tour ×
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.

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?

share|improve this question
add comment

1 Answer

up vote 10 down vote accepted

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.

share|improve this answer
    
Perfect! Thank you. –  rekire Dec 7 '11 at 17:37
add comment

Your Answer

 
discard

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.