# Problem creating a proper qrcode with vcard info

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.

How should I do it?

Regards, F.

• Try removing trailing ^^J from the vcard code. – Tahtisilma Nov 18 '14 at 12:22
• No, doesn't fix the problem. – Fuji San Nov 18 '14 at 12:27
• There seems to be a problem with your vcard format, not with the generated qrcode nor with latex. – TonioElGringo Nov 18 '14 at 14:05
• I cannot find fault with your vcard block. May have to specify QRCode version. I had to when the URLs were too long for v.4 which was default. Yours seem to be v.5 though. – ajeh Nov 18 '14 at 14:13

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:

The 2 qrcode generated here are not the same and the first doesn't give any info. The second does for me. So you see, same vcard format.

\documentclass[english,11pt,a4paper]{article}

\usepackage{qrcode}
\usepackage[utf8]{inputenc}
\usepackage{pst-barcode}

{\obeylines\gdef^^M{^^J}%
\catcode\@=0 %
\catcode\\=12 %
@gdef@n{\n}}

\usepackage{auto-pst-pdf} % uncomment this if used with pdflatex

\begin{document}

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

\medskip
\begin{pspicture}(1in,1in)
\obeylines
\psbarcode{%
BEGIN:VCARD
VERSION:4.0
N:Doe;John
TEL;TYPE=work:+1(234)567-8910
EMAIL:john@doe.com
END:VCARD
}{width=1. height=1.}{qrcode}%
\end{pspicture}

\end{document}


• I guess the qrcodes do not work the same in package qrcode or pst-barcode. – Fuji San Nov 18 '14 at 14:59

Rin with xelatex

\documentclass{article}
\usepackage{pst-barcode}
\begin{document}

\begin{pspicture}(1in,1in)
\psbarcode{%
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
}{encoding=raw}{qrcode}
\end{pspicture}
\end{document}


This is not a latex issue, the format of your vcard is wrong.

Try the following:

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

• Sorry, you did not solve the problem. Still no info after the scan. – Fuji San Nov 18 '14 at 14:34
• As I said, this is not a latex problem, since the qrcode is rendered properly. Maybe your phone is not compatible with this version of vcard? – TonioElGringo Nov 18 '14 at 14:37
• I don't have problem scanning the same info generated with pst-barcode. – Fuji San Nov 18 '14 at 14:50