7

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.

14

2 Answers 2

7

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.

2
  • As suggested by @mas in this link the tags BEGIN:VCALENDAR and END:VCALENDAR can be removed if you have problems. I tested without this tags and still works.
    – PinoSan
    Commented Sep 13, 2011 at 17:16
  • 1
    @PinoSan Thanks, it works with my barcode scanning app too. I've edited my answer by removing the BEGIN and END VCALENDAR lines.
    – imnothere
    Commented Sep 14, 2011 at 1:21
0

Here's a detailed answer:

\documentclass{article}
\usepackage{pst-barcode}
\begin{document}
  \begin{pspicture}(1in,1in)
    \psbarcode{test string}{}{qrcode}
  \end{pspicture}
\end{document}

produces

enter image description here

You'll need to use LaTeX and not PDFLaTeX since the package uses pstricks.

3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .