Some people like having a icon in the centre of their QR code... I want to use the QRCode library to produce such a QR code.

qrcode with icon

For now, I'm using

\documentclass[landscape,8pt]{minimal}
\usepackage{varwidth}
\usepackage{tikz}
\usepackage[]{qrcode}
\usepackage{graphicx}
\setkeys{Gin}{keepaspectratio}
\begin{document}
\topskip0pt
% https://github.com/zxing/zxing/wiki/Barcode-Contents
\centering\noindent\resizebox*\textwidth\textheight{\begin{varwidth}{\textwidth}%
\begin{tabular}{@{}c@{}}%
%
%
\begin{tikzpicture}[node distance=2mm]
\node (qrc) {\qrcode[]{WIFI:T:WPA;S:trololol;P:"12345678";;}};
\node [anchor=center,fill=white,inner sep=4pt,scale=0.02] 
    (icon) at (qrc.center) {\includegraphics{wifi}};
\end{tikzpicture}
%
%
\end{tabular}%
\\%
\centering 12345678
\end{varwidth}}
\end{document}

to generate it, but it feels a bit weird, having to scale the icon manually. Also, I'm guessing that if the icon is big enough, the error recovery capabilities of the qrcode need to be adapted.

Is there any more convenient way of including such a centrally placed icon?

share|improve this question
    
Can you give full code starting from \documentclass and ending at \end{document}? – user11232 Mar 27 '15 at 10:44
    
As far as I know, the icon needs to be always taken into account whhen computing the QR code. – yo' Mar 27 '15 at 10:45
    
possibly related: How to add text into a QR-Code? – barbara beeton Mar 27 '15 at 12:35
1  
Not related, but you should read: why-should-the-minimal-class-be-avoided – Ignasi Mar 27 '15 at 14:53
up vote 1 down vote accepted

Labels can be added at center of nodes. You can use this option instead of an independent node.

\documentclass[landscape,8pt]{article}
\usepackage{varwidth}
\usepackage{tikz}
\usepackage[]{qrcode}
\usepackage{graphicx}
\setkeys{Gin}{keepaspectratio}
\begin{document}
\topskip0pt
% https://github.com/zxing/zxing/wiki/Barcode-Contents
\centering\noindent\resizebox*\textwidth\textheight{\begin{varwidth}{\textwidth}%
\begin{tabular}{@{}c@{}}%
%
%
\begin{tikzpicture}[node distance=2mm]
\node[label={[anchor=center, fill=white, scale=0.02]center:{\includegraphics{wifi}}}] (qrc) {\qrcode[]{WIFI:T:WPA;S:trololol;P:"12345678";;}};
\end{tikzpicture}
%
%
\end{tabular}%
\\%
\centering 12345678
\end{varwidth}}
\end{document}

enter image description here

share|improve this answer

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.