# Hot to draw a specific border around a QR-code?

As the treasurer of an association it's my duty to send out yearly invoices for membership dues. I use scrlttr2 on LuaLaTeX for that, and it's working fine. To allow for easier payment, I am using a QR-Code containing the relevant payment info. That, too, works largely as expected:

\documentclass{scrlttr2}

\usepackage[absolute]{textpos}
\usepackage[forget]{qrcode}

% \usepackage[ngerman]{babel} % Not used due to conflict with qrcode

\setkomavar{signature}{Nomen Nescio, Honcho in Chief}

\begin{document}
\begin{letter}{To: All members}

\opening{Dear all,}

\closing{Kthanksbye,}

\begin{textblock*}{10cm}(13.5cm,22cm)%
\begin{minipage}[c]{7cm} % use \? for newline, all spaces must be prefixed with \
\qrcode[height=4cm,level="M"]{BCD\?001\?1\?SCT\?ABCDATWW\?Applepie\ Appreciation\ Society\?AT611904300234573201\?EUR90\?\?MyUniqueReference\?\?}
\end{minipage}
\end{textblock*}

\end{letter}
\end{document}


Apparently there is some software or app, however, that doesn't recognize these codes unless they have a specific border drawn around them like this:

Is there an easy way to draw that border with LaTeX (TikZ?), or do I have to use a transparent image of the border and just position it on top of the created QR-Code? (Using \AddToShipoutPicture or something similar is my plan B at this point.)

• How about adding a simple \fbox to it? If this does not work I would suffest the tcolorboxpackage. Dec 14 '20 at 19:46
• Is the text on the right side mandatory, or only the frame? Dec 14 '20 at 19:49
• I don't actually know, to be honest. I'll need to get in touch with that user and test, but I think without the text would be fine for now. Dec 14 '20 at 20:20
• Actually, the text was relatively easy. I used \rotatebox{90}{\colorbox{white}{Zahlen mit Code}} insided another \begin{textblock*} and got it all to work. Dec 14 '20 at 21:08

Thanks to your comments and contributions I was able to get it to work:

\documentclass{scrlttr2}

\usepackage[absolute]{textpos}
\usepackage[forget]{qrcode}
\usepackage{tcolorbox}
\usepackage[shorthands=off,ngerman]{babel}

\setkomavar{signature}{Nomen Nescio, Honcho in Chief}

\begin{document}
\begin{letter}{To: All members}

\opening{Dear all,}

\closing{Kthanksbye,}

\begin{textblock*}{10cm}(13.5cm,22cm)%
\begin{minipage}[c]{6,75cm} % use \? for newline, all spaces must be prefixed with \

\begin{tcolorbox}[colback=white,grow to right by=-17mm]
\qrcode[height=4cm,level="M"]{BCD\?001\?1\?SCT\?ABCDATWW\?Applepie\ Appreciation\ Society\?AT611904300234573201\?EUR90\?\?MyUniqueReference\?\?}
\end{tcolorbox}

\end{minipage}
\end{textblock*}

\begin{textblock*}{2cm}(18.25cm,23cm)%
\rotatebox{90}{\colorbox{white}{Zahlen mit Code}}
\end{textblock*}

\end{letter}
\end{document}


Without the text I would suggest:

\documentclass{scrlttr2}

\usepackage[absolute]{textpos}
\usepackage[forget]{qrcode}
\usepackage{tcolorbox}
\usepackage{lipsum}

\definecolor{mycolor}{rgb}{0.122, 0.435, 0.698}

% \usepackage[ngerman]{babel} % Not used due to conflict with qrcode

\setkomavar{signature}{Nomen Nescio, Honcho in Chief}

\begin{document}
\begin{letter}{To: All members}

\opening{Dear all,}

\closing{Kthanksbye,}

\begin{textblock*}{10cm}(13.5cm,22cm)%
\begin{minipage}[c]{7cm} % use \? for newline, all spaces must be prefixed with \

\begin{tcolorbox}[colback=white,grow to right by=-17mm]
\qrcode[height=4cm,level="M"]{BCD\?001\?1\?SCT\?ABCDATWW\?Applepie\ Appreciation\ Society\?AT611904300234573201\?EUR90\?\?MyUniqueReference\?\?}
\end{tcolorbox}
\end{minipage}
\end{textblock*}

\end{letter}
\end{document}

• Thanks for pointing me in the right direction. I was able to get it to work: Using another \begin{textblock*} environment the text, it's working good now. Dec 14 '20 at 21:07