我想放置一个包含联系信息的二维码(电子名片)。但是我不知道如何对换行符进行编码,以便正确读取 VCard。
以下是一个不带换行符的 QRCode 示例文档(更新:我把例子改成了维基百科因为我的 iPhone 二维码阅读器无法正确处理来自维基百科)):
\documentclass{article}
\usepackage{pst-barcode}
\begin{document}
\begin{pspicture}(1in,1in)
\obeylines
\psbarcode{%
BEGIN:VCARD
VERSION:3.0
N:Mustermann;Max
FN:Max Mustermann
ORG:Wikipedia
URL:http://de.wikipedia.org/
EMAIL;TYPE=INTERNET:[email protected]
TEL;TYPE=voice,work,pref:+49 1234 56788
ADR;TYPE=intl,work,postal,parcel:;;Musterstraße 1;Musterstadt;;12345;Germany
END:VCARD
}{width=2.0 height=2.0}{qrcode}%
\end{pspicture}
\end{document}
答案1
以下代码做的正确吗?
\documentclass{article}
\usepackage{pst-barcode}
{\obeylines\gdef^^M{^^J}%
\catcode`\@=0 %
\catcode`\\=12 %
@gdef@n{\n}}
\begin{document}
\begin{pspicture}(1in,1in)
\obeylines
\psbarcode{%
BEGIN:VCARD
VERSION:3.0
N:Gump;Forrest
FN:Forrest Gump
ORG:Bubba Gump Shrimp Co.
TITLE:Shrimp Man
TEL;TYPE=WORK,VOICE:(111) 555-1212
TEL;TYPE=HOME,VOICE:(404) 555-1212
ADR;TYPE=WORK:;;100 Waters Edge;Baytown;LA;30314;United States of America
LABEL;TYPE=WORK:100 Waters Edge\n Baytown, LA 30314\n United States of America
ADR;TYPE=HOME:;;42 Plantation St.;Baytown;LA;30314;United States of America
LABEL;TYPE=HOME:42 Plantation St.\n Baytown, LA 30314\n United States of America
EMAIL;TYPE=PREF,INTERNET:[email protected]
REV:20080424T195243Z
END:VCARD
}{width=2.0 height=2.0}{qrcode}%
\end{pspicture}
\end{document}