added image in qr-code or next to name - improvements

This commit is contained in:
Marc Wäckerlin
2025-11-08 17:30:48 +01:00
parent 9c4d85528a
commit 0f802a02a8
10 changed files with 120 additions and 14 deletions
+6 -5
View File
@@ -21,8 +21,8 @@
\DeclareStringOption[0.50]{textwidth}
\DeclareStringOption[0.40]{qrwidth}
\DeclareStringOption[Q]{qreclevel} % QR code error correction level (L,M,Q,H) default Q
\DeclareStringOption[0.15]{qrlogoscale} % relative size of logo in QR code (0-1), default 0.15 = 15%
\DeclareStringOption[0.02]{qrlogoborder} % white padding around the photo overlay in QR code
\DeclareStringOption[25]{qrlogoscale} % photo size in QR code as percentage of QR width (0-100), default 25%
\DeclareStringOption[2]{qrlogoborder} % white padding around photo in QR as percentage of QR width (0-100), default 2%
\DeclareStringOption[de]{lang}
\DeclareBoolOption[false]{ioscrlf} % use CRLF line endings in vCard (iOS compatibility); default off to avoid pdfTeX issues
\DeclareBoolOption[false]{photoinqr} % if true: photo goes in QR center; if false (default): photo next to name
@@ -256,9 +256,10 @@ END:VCARD\BCQ@nl}
\ifcsdef{Xphoto}{%
\begin{tikzpicture}
\node[inner sep=0pt] (qr) {\qrcode[level=\BCQ@qreclevel,version=0,height=\textwidth]{\vcard}};
% White padding behind the photo to improve readability
\node[fill=white, rounded corners=0.5pt, inner sep=\BCQ@qrlogoborder\textwidth] at (qr.center) {%
\includegraphics[width=\BCQ@qrlogoscale\textwidth]{\Xphoto}%
% Photo with transparent background preserved (no fill), padding still applied
% Convert percentage values to fractions for calculations
\node[inner sep=\fpeval{\BCQ@qrlogoborder/100}\textwidth] at (qr.center) {%
\includegraphics[width=\fpeval{\BCQ@qrlogoscale/100}\textwidth]{\Xphoto}%
};
\end{tikzpicture}%
}{%