options updated, local options added
This commit is contained in:
+95
-36
@@ -20,7 +20,7 @@
|
||||
\DeclareStringOption[1]{cutlen}
|
||||
\DeclareStringOption[0.50]{textwidth}
|
||||
\DeclareStringOption[0.40]{qrwidth}
|
||||
\DeclareStringOption[Q]{qreclevel} % QR code error correction level (L,M,Q,H) default Q
|
||||
\DeclareStringOption[H]{qreclevel} % QR code error correction level (L,M,Q,H)
|
||||
\DeclareStringOption[0.25]{qrlogoscale} % logo size in QR code as fraction of QR width (1.0 = 100%), default 0.25
|
||||
\DeclareStringOption[0.02]{qrlogoborder} % white padding around logo in QR as fraction of QR width (1.0 = 100%), default 0.02
|
||||
\DeclareStringOption{logoheight} % logo height next to name (with unit, e.g., 4em), default: 4em if company set, 2em otherwise
|
||||
@@ -29,7 +29,6 @@
|
||||
\DeclareStringOption[1.0]{qrbgopacity} % QR code background opacity (1.0 = white solid, 0.0 = transparent), default 1.0
|
||||
\DeclareStringOption[de]{lang}
|
||||
\DeclareBoolOption[false]{ioscrlf} % use CRLF line endings in vCard (iOS compatibility); default off to avoid pdfTeX issues
|
||||
\DeclareBoolOption[false]{logoinqr} % if true: logo goes in QR center; if false (default): logo next to name
|
||||
\DeclareBoolOption[true]{address}
|
||||
\DeclareComplementaryOption{noaddress}{address}
|
||||
\DeclareBoolOption[true]{hint}
|
||||
@@ -133,8 +132,41 @@
|
||||
\registerData{google}
|
||||
\registerData{pgpurl}
|
||||
\registerData{pgpfingerprint}
|
||||
\registerData{logo} % path to logo file for display next to name
|
||||
\registerData{background} % path to background image file or color name
|
||||
|
||||
% Special commands with optional parameters
|
||||
% \logo[height=...]{file} - logo next to name, overrides logoheight option
|
||||
\define@key{BCQ@logo}{height}{\def\BCQ@logoheight@local{#1}}
|
||||
\newcommand\logo[2][]{
|
||||
\def\Xlogo{#2}
|
||||
\def\BCQ@logo@tmp{#1}%
|
||||
\ifx\BCQ@logo@tmp\@empty\else
|
||||
\setkeys{BCQ@logo}{#1}
|
||||
\fi
|
||||
}
|
||||
|
||||
% \qrlogo[scale=...,opacity=...]{file} - logo in QR code center (scale is unitless fraction like 0.3)
|
||||
\define@key{BCQ@qrlogo}{scale}{\def\BCQ@qrlogoscale@local{#1}}
|
||||
\define@key{BCQ@qrlogo}{opacity}{\def\BCQ@qrbgopacity@local{#1}}
|
||||
\newcommand\qrlogo[2][]{
|
||||
\def\Xqrlogo{#2}
|
||||
\def\BCQ@qrlogo@tmp{#1}%
|
||||
\ifx\BCQ@qrlogo@tmp\@empty\else
|
||||
\setkeys{BCQ@qrlogo}{#1}
|
||||
\fi
|
||||
}
|
||||
|
||||
% \background[scale=...,opacity=...]{file/color} - background image or color
|
||||
\define@key{BCQ@background}{scale}{\def\BCQ@bgscale@local{#1}}
|
||||
\define@key{BCQ@background}{opacity}{\def\BCQ@bgopacity@local{#1}}
|
||||
\newcommand\background[2][]{
|
||||
\def\Xbackground{#2}
|
||||
\def\BCQ@background@tmp{#1}%
|
||||
\ifx\BCQ@background@tmp\@empty\else
|
||||
\setkeys{BCQ@background}{#1}
|
||||
\fi
|
||||
}
|
||||
|
||||
\registerData{companylogo} % content (image/object) to display instead of company text (company still in vCard)
|
||||
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
@@ -305,33 +337,39 @@ END:VCARD\BCQ@nl}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% insertqrcode - insert the qr-code with optional white background
|
||||
\newcommand\insertqrcode{
|
||||
% Use local overrides if specified, otherwise use global options
|
||||
\ifcsdef{BCQ@qrbgopacity@local}{%
|
||||
\edef\BCQ@qrbgopacity@used{\BCQ@qrbgopacity@local}%
|
||||
}{%
|
||||
\edef\BCQ@qrbgopacity@used{\BCQ@qrbgopacity}%
|
||||
}%
|
||||
\ifcsdef{BCQ@qrlogoscale@local}{%
|
||||
\edef\BCQ@qrlogoscale@used{\BCQ@qrlogoscale@local}%
|
||||
}{%
|
||||
\edef\BCQ@qrlogoscale@used{\BCQ@qrlogoscale}%
|
||||
}%
|
||||
%\frame
|
||||
{
|
||||
\begin{minipage}[c][\heightscale][c]{\imagepercents\textwidth}
|
||||
\begin{tikzpicture}
|
||||
% White background behind QR code (for readability over background images)
|
||||
\node[fill=white, opacity=\fpeval{\BCQ@qrbgopacity}, inner sep=0pt, outer sep=2mm, minimum size=\textwidth] (bg) at (0,0) {};
|
||||
\node[fill=white, opacity=\fpeval{\BCQ@qrbgopacity@used}, inner sep=0pt, outer sep=2mm, minimum size=\textwidth] (bg) at (0,0) {};
|
||||
% QR code on top
|
||||
\node[inner sep=0pt, outer sep=0pt] (qr) at (0,0) {%
|
||||
\ifBCQ@logoinqr
|
||||
% QR code with logo overlay in center
|
||||
\ifcsdef{Xlogo}{%
|
||||
% QR code with optional qrlogo overlay in center
|
||||
\ifcsdef{Xqrlogo}{%
|
||||
\begin{tikzpicture}
|
||||
\node[inner sep=0pt] (qr2) {\qrcode[level=\BCQ@qreclevel,version=0,height=\textwidth]{\vcard}};
|
||||
% Logo with transparent background preserved (no fill), padding still applied
|
||||
% qrlogoscale and qrlogoborder are now fractions (1.0 = 100%)
|
||||
% qrlogoscale/scale is unitless fraction (0.25 = 25% of QR width)
|
||||
\node[inner sep=\BCQ@qrlogoborder\textwidth] at (qr2.center) {%
|
||||
\includegraphics[width=\BCQ@qrlogoscale\textwidth]{\Xlogo}%
|
||||
\includegraphics[width=\BCQ@qrlogoscale@used\textwidth]{\Xqrlogo}%
|
||||
};
|
||||
\end{tikzpicture}%
|
||||
}{%
|
||||
% No logo defined, just show QR code
|
||||
% No qrlogo defined, just show QR code
|
||||
\qrcode[level=\BCQ@qreclevel,version=0,height=\textwidth]{\vcard}%
|
||||
}%
|
||||
\else
|
||||
% Standard QR code without overlay
|
||||
\qrcode[level=\BCQ@qreclevel,version=0,height=\textwidth]{\vcard}%
|
||||
\fi
|
||||
};
|
||||
\end{tikzpicture}
|
||||
\end{minipage}
|
||||
@@ -348,36 +386,46 @@ END:VCARD\BCQ@nl}
|
||||
\ifx\BCQ@logoheight\@empty
|
||||
\ifcsdef{Xcompany}{\def\BCQ@logoheight{4em}}{\def\BCQ@logoheight{2em}}%
|
||||
\fi
|
||||
% Use local height override if specified, otherwise use global logoheight
|
||||
\ifcsdef{BCQ@logoheight@local}{%
|
||||
\edef\BCQ@logoheight@used{\BCQ@logoheight@local}%
|
||||
}{%
|
||||
\edef\BCQ@logoheight@used{\BCQ@logoheight}%
|
||||
}%
|
||||
% Store logo height as dimension for heightscale calculation
|
||||
\ifcsdef{Xlogo}{%
|
||||
\setlength{\BCQ@logoheightdimen}{\BCQ@logoheight}%
|
||||
\setlength{\BCQ@logoheightdimen}{\BCQ@logoheight@used}%
|
||||
}{%
|
||||
\setlength{\BCQ@logoheightdimen}{0pt}%
|
||||
}%
|
||||
% Compute heightscale after logo height is known
|
||||
\computeheightscale
|
||||
\ifcsdef{Xlogo}{% logo defined
|
||||
\ifBCQ@logoinqr
|
||||
% Logo in QR code: show name only
|
||||
{\bfseries\cond{name}}%
|
||||
\ifexists{Xcompany}{\\\Xcompany}%
|
||||
\else
|
||||
% Logo next to name: two-column layout (logo | name)
|
||||
\begin{minipage}{\textwidth}
|
||||
\begin{minipage}[c]{0.30\textwidth}% logo column
|
||||
\includegraphics[height=\BCQ@logoheight]{\Xlogo}%
|
||||
\end{minipage}
|
||||
\hfill
|
||||
\begin{minipage}[c]{0.67\textwidth}% name column
|
||||
\ifBCQ@rightalign\raggedleft\fi% apply alignment
|
||||
{\bfseries\cond{name}}%
|
||||
\ifexists{Xcompany}{\\\Xcompany}%
|
||||
\end{minipage}
|
||||
% Logo next to name: two-column layout (logo | name)
|
||||
\begin{minipage}{\textwidth}
|
||||
\begin{minipage}[c]{0.30\textwidth}% logo column
|
||||
\includegraphics[height=\BCQ@logoheight@used]{\Xlogo}%
|
||||
\end{minipage}
|
||||
\fi
|
||||
\hfill
|
||||
\begin{minipage}[c]{0.67\textwidth}% name column
|
||||
\ifBCQ@rightalign\raggedleft\fi% apply alignment
|
||||
{\bfseries\cond{name}}%
|
||||
% Show companylogo if set (only logo), otherwise show company text
|
||||
\ifcsdef{Xcompanylogo}{%
|
||||
\\\Xcompanylogo% only show logo
|
||||
}{%
|
||||
\ifexists{Xcompany}{\\\Xcompany}% show company text
|
||||
}%
|
||||
\end{minipage}
|
||||
\end{minipage}
|
||||
}{% no logo: just name
|
||||
{\bfseries\cond{name}}%
|
||||
\ifexists{Xcompany}{\\\Xcompany}%
|
||||
% Show companylogo if set (only logo), otherwise show company text
|
||||
\ifcsdef{Xcompanylogo}{%
|
||||
\\\Xcompanylogo% only show logo
|
||||
}{%
|
||||
\ifexists{Xcompany}{\\\Xcompany}% show company text
|
||||
}%
|
||||
}
|
||||
}
|
||||
|
||||
@@ -411,6 +459,17 @@ END:VCARD\BCQ@nl}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% drawcard - main card with optional background
|
||||
\newcommand\drawcard{
|
||||
% Use local overrides if specified, otherwise use global options
|
||||
\ifcsdef{BCQ@bgscale@local}{%
|
||||
\edef\BCQ@bgscale@used{\BCQ@bgscale@local}%
|
||||
}{%
|
||||
\edef\BCQ@bgscale@used{\BCQ@bgscale}%
|
||||
}%
|
||||
\ifcsdef{BCQ@bgopacity@local}{%
|
||||
\edef\BCQ@bgopacity@used{\BCQ@bgopacity@local}%
|
||||
}{%
|
||||
\edef\BCQ@bgopacity@used{\BCQ@bgopacity}%
|
||||
}%
|
||||
% Handle background
|
||||
\ifcsdef{Xbackground}{%
|
||||
\IfFileExists{\Xbackground}{%
|
||||
@@ -418,8 +477,8 @@ END:VCARD\BCQ@nl}
|
||||
\AddToShipoutPictureBG*{%
|
||||
\AtPageCenter{%
|
||||
\begin{tikzpicture}[overlay]
|
||||
\node[inner sep=0pt, opacity=\fpeval{\BCQ@bgopacity}] at (0,0) {%
|
||||
\includegraphics[height=\fpeval{\BCQ@bgscale}\paperheight]{\Xbackground}%
|
||||
\node[inner sep=0pt, opacity=\fpeval{\BCQ@bgopacity@used}] at (0,0) {%
|
||||
\includegraphics[height=\fpeval{\BCQ@bgscale@used}\paperheight]{\Xbackground}%
|
||||
};
|
||||
\end{tikzpicture}%
|
||||
}%
|
||||
|
||||
Reference in New Issue
Block a user