如何在二维码周围绘制特定边框?

如何在二维码周围绘制特定边框?

作为协会的财务主管,我有责任每年发送会员费发票。我使用scrlttr2这个LuaLaTeX,效果很好。为了方便付款,我使用了包含相关付款信息的二维码。这也基本符合预期:

\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,}

Please pay up!

\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}

在此处输入图片描述

显然,有些软件或应用程序无法识别这些代码,除非它们周围画有特定的边框,如下所示:

在此处输入图片描述

LaTeX有没有一种简单的方法可以用( ?)绘制边框TikZ,或者我必须使用边框的透明图像并将其放置在创建的二维码之上?(\AddToShipoutPicture此时使用或类似的东西是我的 B 计划。)

答案1

感谢您的评论和贡献,我才能让它发挥作用:

\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,}

Please pay up!

\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}

在此处输入图片描述

答案2

如果没有文字的话我建议:

\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,}

Please pay up!

\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}

相关内容