[Tex/LaTex] How to generate QR code for iCalendar event

barcodespdftexpst-barcode

I would like to include in a pdf file a QR code containing information from a iCalendar event.

Here it is the code to generate a simple event for an iCalendar:

BEGIN:VEVENT
SUMMARY:event
DTSTART:20110913T130000Z
DTEND:20110913T140000Z
END:VEVENT

I would like to generate a QR code for that text so I get it from my Android phone and automatically insert a new event in my Calendar app.

EDIT 1:

I found out in this and this post how you can generate a QR code. I generated a QR code but my Android app was not able to understand that the text was a iCalendar event.

EDIT 2:

After @Yossi suggestion I add the following code. That was supposed to create a valid QR code with an iCal event. That is the same code that I used to generating other QR codes but it is not working as I want with iCal events.

\documentclass[a4paper,10pt]{article}

\usepackage{pst-barcode}
\usepackage{auto-pst-pdf}

\usepackage[utf8x]{inputenc}

\begin{document}
\maketitle

\begin{pspicture}(0.7in,0.7in)
\psbarcode{%
BEGIN:VEVENT
SUMMARY:event
DTSTART:20110913T130000Z
DTEND:20110913T140000Z
END:VEVENT
}{}{qrcode}
\end{pspicture}

\end{document}

And here it is the command I used for compiling my tex file:

pdflatex --shell-escape

I can generate the QR code but for some reason the text encoded is not a valid iCal event.

Best Answer

The QR code generated by following was recognised as an iCalendar event by Qrafter on an iPad:

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

\begin{pspicture}(2in,2in)
\psbarcode{BEGIN:VEVENT^^J%
SUMMARY:event^^J%
DTSTART:20110913T130000Z^^J%
DTEND:20110913T140000Z^^J%
END:VEVENT}
{height=2 width=2}{qrcode}
\end{pspicture}

\end{document}

The ^^J are needed for newlines. If you prefer, you can also play around with the catcodes to avoid having to type ^^J, as demonstrated in this related question on generating QR codes containing vCards.