[Tex/LaTex] Problem creating a proper qrcode with vcard info

barcodespdftex

I have this little latex file generating a qr-code using Hendrickson's qrcode.sty found here: pgf-Tikz QR code generator.

\documentclass[english,11pt,a4paper]{article}
\usepackage{qrcode}
\begin{document}
\qrcode{
BEGIN:VCARD^^J
VERSION:4.0^^J
N:Doe;John^^J
TEL;WORK:+1 (234) 567-8910^^J
EMAIL:john@doe.com^^J
END:VCARD
}
\end{document}

It generates indeed the following qr-code but when i scan it with my phone, I get no information.

QR-code with non info.

How should I do it?

Regards,
F.

Best Answer

Even after you remove the trailing ^^J, it won't work quite the way you wanted, as others have noted. After some experimenting, I found that removing all regular newlines and adding \? (which is qrcode's marker for "newline") does the trick:

\qrcode{BEGIN:VCARD\?VERSION:4.0\?N:Doe;John\?TEL;TYPE=work:+1(234)567-8910\?EMAIL:john@doe.com\?END:VCARD}

(with no linebreak) works exactly the way you want, at least when I check it with my phone. Here's what it looks like:

John Doe vcard, via \qrcode

Related Question