diff --git a/README.md b/README.md index 20ab926..86f4008 100644 --- a/README.md +++ b/README.md @@ -95,11 +95,11 @@ Layout options are set as options to the `\documentclass`, e.g.: - `qrfirst` or `textfirst`: switch position of QR-Code and text block, default: `qrfirst` - `https` or `www`: should links in the hints be prefixed with `https://` or `www.`, default: `https` - `countryformat=`: how to format the country in address. Values: `auto` (default: inline with mdash if <4 chars and city/zip exists), `inline` (always inline with mdash), `below` (always separate line) -- `qreclevel=`: QR error correction level `L` (~7%), `M` (~15%), `Q` (~25%), or `H` (~30%), default: `Q`. Use `H` when `photoinqr=true`. -- `photoinqr` or `nophotoinqr`: place photo in the center of the QR code (`photoinqr`) instead of next to the name, default: `nophotoinqr`. **Requires `qreclevel=H` for reliable scanning**. -- `qrlogoscale=`: photo size in QR code as fraction of QR width (1.0 = 100%), default: `0.25` (25% width). Recommended values: Level H: 0.25-0.3, Level Q: 0.2, Level M: 0.15, Level L: 0.1. Higher values may reduce scannability. -- `qrlogoborder=`: transparent padding around photo in QR code as fraction of QR width (1.0 = 100%), default: `0.02` (2%). Adds space between photo and QR modules. -- `photoscale=`: scale factor for photo next to name (1.0 = 100% of name height), default: `1.0`. Use values like `2.0` or `2.5` for larger photos. +- `qreclevel=`: QR error correction level `L` (~7%), `M` (~15%), `Q` (~25%), or `H` (~30%), default: `Q`. Use `H` when `logoinqr=true`. +- `logoinqr` or `nologoinqr`: place logo in the center of the QR code (`logoinqr`) instead of next to the name, default: `nologoinqr`. **Requires `qreclevel=H` for reliable scanning**. +- `qrlogoscale=`: logo size in QR code as fraction of QR width (1.0 = 100%), default: `0.25` (25% width). Recommended values: Level H: 0.25-0.3, Level Q: 0.2, Level M: 0.15, Level L: 0.1. Higher values may reduce scannability. +- `qrlogoborder=`: transparent padding around logo in QR code as fraction of QR width (1.0 = 100%), default: `0.02` (2%). Adds space between logo and QR modules. +- `logoscale=`: scale factor for logo next to name (1.0 = 100% of name height), default: `1.0`. Use values like `2.0` or `2.5` for larger logos. - `bgscale=`: background image scale factor (1.0 = 100% of card height), default: `1.0`. Use values like `1.5` or `2.0` for zoomed/cropped backgrounds. Only affects images, not colors. - `bgopacity=`: background image opacity/transparency (1.0 = 100% visible, 0.0 = invisible), default: `1.0`. Use lower values like `0.2` or `0.3` to fade the background so text remains readable. Only affects images, not colors. - `qrbgopacity=`: QR code background opacity (1.0 = solid white, 0.0 = transparent), default: `1.0`. White background behind QR code ensures scannability over background images. Use `0.0` for no background or lower values like `0.8` for semi-transparent. @@ -160,7 +160,7 @@ See this example_ - `\google`: your account name on [google+] — only the name of the account, the url is prepended automatically - `\pgpurl`: the full url to your pgp public key (only added to the QR-Code, not shown in the text) - `\pgpfingerprint`: the fingerprint of your pgp public key -- `\photo`: path to photo file (PNG, JPG, etc.) for display next to name or in QR code (if `photoinqr` option is set) +- `\logo`: path to logo file (PNG, JPG, etc.) for display next to name or in QR code (if `logoinqr` option is set) - `\background`: path to background image file or color name (e.g., `yellow!20`, `blue!10`). If file exists, it's used as image; otherwise treated as color. @@ -208,40 +208,40 @@ Save it as file [texstudio_d30266.tex] and compile it to get [texstudio_d30266.p See [examples] for more examples. -Photo (optional) -================ +Logo (optional) +=============== -You can add an optional photo that appears next to the name or in the center of the QR code. The photo is dynamically scaled to match the name line height (when next to name) or to 25% of the QR code width (when in QR). +You can add an optional logo that appears next to the name or in the center of the QR code. The logo is dynamically scaled to match the name line height (when next to name) or to 25% of the QR code width (when in QR). ```latex -\photo{path/to/photo.png} +\logo{path/to/logo.png} ``` -### Photo Placement Options: +### Logo Placement Options: -**Default (photo next to name):** +**Default (logo next to name):** ```latex \documentclass{businesscard-qrcode} -\photo{photo.png} +\logo{logo.png} ``` -**Photo in QR code center:** +**Logo in QR code center:** ```latex -\documentclass[photoinqr,qreclevel=H,qrlogoscale=0.25]{businesscard-qrcode} -\photo{photo.png} +\documentclass[logoinqr,qreclevel=H,qrlogoscale=0.25]{businesscard-qrcode} +\logo{logo.png} ``` -**Important:** When using `photoinqr=true`: +**Important:** When using `logoinqr=true`: - Always use `qreclevel=H` (highest error correction ~30%) for reliable scanning - Test QR code scannability with multiple apps before printing - Default `qrlogoscale=0.25` (25% width = 6.25% area) is recommended for Level H - If scanning fails, reduce to `qrlogoscale=0.2` or `qrlogoscale=0.15` - PNG transparency is preserved - use images with transparent backgrounds for best results -**Large photo next to name:** +**Large logo next to name:** ```latex -\documentclass[photoscale=2.5]{businesscard-qrcode} -\photo{photo.png} +\documentclass[logoscale=2.5]{businesscard-qrcode} +\logo{logo.png} ``` **Background color:** diff --git a/businesscard-qrcode.cls b/businesscard-qrcode.cls index 2d5dd76..06260c4 100644 --- a/businesscard-qrcode.cls +++ b/businesscard-qrcode.cls @@ -21,15 +21,15 @@ \DeclareStringOption[0.50]{textwidth} \DeclareStringOption[0.40]{qrwidth} \DeclareStringOption[Q]{qreclevel} % QR code error correction level (L,M,Q,H) default Q -\DeclareStringOption[0.25]{qrlogoscale} % photo size in QR code as fraction of QR width (1.0 = 100%), default 0.25 -\DeclareStringOption[0.02]{qrlogoborder} % white padding around photo in QR as fraction of QR width (1.0 = 100%), default 0.02 -\DeclareStringOption[1.0]{photoscale} % scale factor for photo next to name (1.0 = 100% name height), default 1.0 +\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[1.0]{logoscale} % scale factor for logo next to name (1.0 = 100% name height), default 1.0 \DeclareStringOption[1.0]{bgscale} % background image scale (1.0 = 100% card height), default 1.0 \DeclareStringOption[1.0]{bgopacity} % background image opacity (1.0 = 100% visible, 0.0 = invisible), default 1.0 \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]{photoinqr} % if true: photo goes in QR center; if false (default): photo next to name +\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} @@ -77,7 +77,7 @@ \RequirePackage{DejaVuSans} \RequirePackage[T1]{fontenc} \RequirePackage{wrapfig} -\RequirePackage{graphicx} % needed for optional photo +\RequirePackage{graphicx} % needed for optional logo \RequirePackage{tikz} % needed for logo overlay in QR code \RequirePackage{eso-pic} % needed for background images without layout impact % Fix XeLaTeX opacity issue: ensure TikZ/PGF is loaded before eso-pic uses opacity @@ -133,7 +133,7 @@ \registerData{google} \registerData{pgpurl} \registerData{pgpfingerprint} -\registerData{photo} % path to photo file for display next to name +\registerData{logo} % path to logo file for display next to name \registerData{background} % path to background image file or color name @@ -159,7 +159,7 @@ % name - assemble full name from the parts, such as Xgivennames and Xfamilynames \newcommand\name{\ifexists{Xhonoricprefix}{\Xhonoricprefix\ }\ifexists{Xgivennames}{\Xgivennames\ }\ifexists{Xfamilynames}{\Xfamilynames}\ifexists{Xhonoricsuffix}{\ \Xhonoricsuffix}} -% internal box for measuring name height when photo is present +% internal box for measuring name height when logo is present \newsavebox{\BCQ@namebox} @@ -297,21 +297,21 @@ END:VCARD\BCQ@nl} \node[fill=white, opacity=\fpeval{\BCQ@qrbgopacity}, 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@photoinqr - % QR code with photo overlay in center - \ifcsdef{Xphoto}{% - \begin{tikzpicture} - \node[inner sep=0pt] (qr2) {\qrcode[level=\BCQ@qreclevel,version=0,height=\textwidth]{\vcard}}; - % Photo with transparent background preserved (no fill), padding still applied - % qrlogoscale and qrlogoborder are now fractions (1.0 = 100%) - \node[inner sep=\BCQ@qrlogoborder\textwidth] at (qr2.center) {% - \includegraphics[width=\BCQ@qrlogoscale\textwidth]{\Xphoto}% - }; - \end{tikzpicture}% - }{% - % No photo defined, just show QR code - \qrcode[level=\BCQ@qreclevel,version=0,height=\textwidth]{\vcard}% - }% + \ifBCQ@logoinqr + % QR code with logo overlay in center + \ifcsdef{Xlogo}{% + \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%) + \node[inner sep=\BCQ@qrlogoborder\textwidth] at (qr2.center) {% + \includegraphics[width=\BCQ@qrlogoscale\textwidth]{\Xlogo}% + }; + \end{tikzpicture}% + }{% + % No logo 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}% @@ -328,16 +328,16 @@ END:VCARD\BCQ@nl} \newcommand\insertname{ % typeset name into box for measurement \sbox{\BCQ@namebox}{\bfseries\cond{name}\ifexists{Xadditionalnames}{\ifcsempty{name}{} { }\Xadditionalnames}}% - \ifcsdef{Xphoto}{% photo defined - \ifBCQ@photoinqr - % Photo in QR code: show name only, same structure as no-photo case + \ifcsdef{Xlogo}{% logo defined + \ifBCQ@logoinqr + % Logo in QR code: show name only, same structure as no-logo case {\bfseries\usebox{\BCQ@namebox}}% \else - % Photo next to name: two-column layout (photo | name) - % photoscale: 1.0 = 100% name height (default), 2.0 = 200%, etc. + % Logo next to name: two-column layout (logo | name) + % logoscale: 1.0 = 100% name height (default), 2.0 = 200%, etc. \begin{minipage}{\textwidth} - \begin{minipage}[c]{0.30\textwidth}% photo column (increased from 0.22) - \includegraphics[height=\fpeval{\BCQ@photoscale}\dimexpr\ht\BCQ@namebox+\dp\BCQ@namebox\relax]{\Xphoto}% scaled to photoscale * name height + \begin{minipage}[c]{0.30\textwidth}% logo column (increased from 0.22) + \includegraphics[height=\fpeval{\BCQ@logoscale}\dimexpr\ht\BCQ@namebox+\dp\BCQ@namebox\relax]{\Xlogo}% scaled to logoscale * name height \end{minipage} \hfill \begin{minipage}[c]{0.67\textwidth}% name column (adjusted from 0.75) @@ -346,7 +346,7 @@ END:VCARD\BCQ@nl} \end{minipage} \end{minipage} \fi - }{% no photo: just name + }{% no logo: just name {\bfseries\usebox{\BCQ@namebox}}% } } diff --git a/examples/background-image-example.pdf b/examples/background-image-example.pdf index 429445e..dedbcd5 100644 Binary files a/examples/background-image-example.pdf and b/examples/background-image-example.pdf differ diff --git a/examples/background-image-example.tex b/examples/background-image-example.tex index 9ce77c6..b3d4a35 100644 --- a/examples/background-image-example.tex +++ b/examples/background-image-example.tex @@ -1,5 +1,5 @@ % !TeX program = xelatex -\documentclass[bgscale=1.2,bgopacity=0.6,qrbgopacity=0.8,photoscale=4]{businesscard-qrcode} +\documentclass[bgscale=1.2,bgopacity=0.6,qrbgopacity=0.8,logoscale=4]{businesscard-qrcode} \type{home} \givennames{Petra} @@ -12,7 +12,7 @@ \phone{+41 61 123 45 67} \email{petra@example.ch} \background{background.png} -\photo{photo.png} +\logo{photo.png} \begin{document} \drawcard diff --git a/examples/photo-example.pdf b/examples/photo-example.pdf index 4e7f04a..c84bc9c 100644 Binary files a/examples/photo-example.pdf and b/examples/photo-example.pdf differ diff --git a/examples/photo-example.tex b/examples/photo-example.tex index 383d1f9..c472bf2 100644 --- a/examples/photo-example.tex +++ b/examples/photo-example.tex @@ -1,14 +1,14 @@ -% Example 1: Photo next to name (default) +% Example 1: Logo next to name (default) \documentclass[qreclevel=Q]{businesscard-qrcode} -% Demonstrates optional photo placement: -% - Default: photo appears next to name (auto-scaled to name height) -% - Alternative: use photoinqr option to place photo in QR code center (requires qreclevel=H) +% Demonstrates optional logo placement: +% - Default: logo appears next to name (auto-scaled to name height) +% - Alternative: use logoinqr option to place logo in QR code center (requires qreclevel=H) -\photo{photo.png} +\logo{photo.png} % Try alternative placement by uncommenting these lines and commenting out the \documentclass above: -% \documentclass[photoinqr,qreclevel=H,qrwidth=0.38,textwidth=0.57]{businesscard-qrcode} +% \documentclass[logoinqr,qreclevel=H,qrwidth=0.38,textwidth=0.57]{businesscard-qrcode} \givennames{Alex} \familynames{Muster} diff --git a/examples/photo-in-qr-example.pdf b/examples/photo-in-qr-example.pdf index 3d34dad..8ebcc07 100644 Binary files a/examples/photo-in-qr-example.pdf and b/examples/photo-in-qr-example.pdf differ diff --git a/examples/photo-in-qr-example.tex b/examples/photo-in-qr-example.tex index 3ff7e94..8c5739e 100644 --- a/examples/photo-in-qr-example.tex +++ b/examples/photo-in-qr-example.tex @@ -1,5 +1,5 @@ % !TeX program = xelatex -\documentclass[photoinqr,qrlogoscale=0.4,qreclevel=H]{businesscard-qrcode} +\documentclass[logoinqr,qrlogoscale=0.4,qreclevel=H]{businesscard-qrcode} \type{home} \givennames{Lisa\ Linda} @@ -12,7 +12,7 @@ \phone{+1 234 567 8900} \email{ldoe@example.com} \homepage{example.com} -%\photo{photo.png} % uncomment if photo.png exists +%\logo{photo.png} % uncomment if photo.png exists \begin{document} \drawcard diff --git a/examples/photo-large-example.pdf b/examples/photo-large-example.pdf index d1078d7..5aad49a 100644 Binary files a/examples/photo-large-example.pdf and b/examples/photo-large-example.pdf differ diff --git a/examples/photo-large-example.tex b/examples/photo-large-example.tex index cb9079c..751af29 100644 --- a/examples/photo-large-example.tex +++ b/examples/photo-large-example.tex @@ -1,16 +1,16 @@ -\documentclass[bgscale=1.2,bgopacity=0.6,qrbgopacity=0.8,photoscale=4]{businesscard-qrcode} +\documentclass[bgscale=1.2,bgopacity=0.6,qrbgopacity=0.8,logoscale=4]{businesscard-qrcode} \type{home} \givennames{Max} \familynames{Muster} -\additionalnames{Big\ Photo\ Example} +\additionalnames{Big\ Logo\ Example} \street{Beispielstrasse\ 42} \city{Winterthur} \zip{8400} \country{CH} \phone{+41 52 123 45 67} \email{max@example.ch} -\photo{photo.png} +\logo{photo.png} \background{background.png} \begin{document} diff --git a/screenshots/photo-example.png b/screenshots/photo-example.png index 77cf97b..200c859 100644 Binary files a/screenshots/photo-example.png and b/screenshots/photo-example.png differ diff --git a/screenshots/photo-in-qr-example.png b/screenshots/photo-in-qr-example.png index 1cb4a44..ac35eba 100644 Binary files a/screenshots/photo-in-qr-example.png and b/screenshots/photo-in-qr-example.png differ