Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
In the event that nobody has a solution involving TeX, you can do that using Inkscape. –  ℝaphink Sep 13 '11 at 14:36
    
see xaphire.de/recipes/?p=344 –  Yossi Farjoun Sep 13 '11 at 14:36
    
@Raphink can you give me some link to how generate QR code in Inkscape? –  PinoSan Sep 13 '11 at 14:43
2  
Does the app work with the sample at http://www.qrdvark.com/qr-formats/ical/, referenced in http://stackoverflow.com/questions/4547927/how-to-generate-qr-code-with-icalend‌​er-in-it? If so, does the same data produce a workable QRcode using the available LaTeX solutions? –  mas Sep 13 '11 at 14:52
1  
@Yossi: This question can be seen as a specialization of Generating 2d barcodes and therefore is not an exact duplicate. The issue is not the actual generation but to generate the barcode the right way. –  Martin Scharrer Sep 14 '11 at 9:31
show 9 more comments

2 Answers

up vote 5 down vote accepted

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.

share|improve this answer
    
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 Sep 13 '11 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. –  LianTze Lim Sep 14 '11 at 1:21
add comment

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.

share|improve this answer
2  
xelatex will also work. –  Torbjørn T. Sep 13 '11 at 14:59
    
Here tex.stackexchange.com/questions/20520/… I found my own solution with pdflatex instead of latex. For using pdflatex you have to use the command "pdflatex --shell-escape" –  PinoSan Sep 13 '11 at 15:02
    
Less detailed than a previous answer, though :-) –  chl Jun 27 '12 at 9:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.