diff --git a/businesscard-qrcode.cls b/businesscard-qrcode.cls index 496e16a..5509de3 100644 --- a/businesscard-qrcode.cls +++ b/businesscard-qrcode.cls @@ -383,13 +383,15 @@ END:VCARD\BCQ@nl} \ifcsdef{Xbackground}{% \IfFileExists{\Xbackground}{% % It's an image file: add to background using eso-pic (no layout impact) - \AddToShipoutPictureBG*{% - \AtPageCenter{% + % Fix XeLaTeX opacity issue: ensure TikZ/PGF is loaded before opacity is used + \AddToHook{shipout/background}[businesscard]{% + \put (\LenToUnit{.5\paperwidth},\LenToUnit{-.5\paperheight}) {% \tikz[overlay]{\node[opacity=\fpeval{\BCQ@bgopacity}, inner sep=0pt] at (0,0) {% \includegraphics[height=\fpeval{\BCQ@bgscale}\paperheight]{\Xbackground}% };}% }% }% + \DeclareHookRule{shipout/background}{pgfrcs}{>}{businesscard}% }{% % Not a file: treat as color \pagecolor{\Xbackground}% diff --git a/examples/background-image-example.pdf b/examples/background-image-example.pdf index 9ae4993..269a47b 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 a9de260..a303aa2 100644 --- a/examples/background-image-example.tex +++ b/examples/background-image-example.tex @@ -1,6 +1,5 @@ % !TeX program = xelatex -\documentclass[bgscale=1.2,bgopacity=0.3,qrbgopacity=0.2 -]{businesscard-qrcode} +\documentclass[bgscale=1.2,bgopacity=0.6,qrbgopacity=0.8,photoscale=4]{businesscard-qrcode} \type{home} \givennames{Petra} diff --git a/examples/photo-large-example.pdf b/examples/photo-large-example.pdf index dd9114e..f534541 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 c5ef0cb..1d9fdd4 100644 --- a/examples/photo-large-example.tex +++ b/examples/photo-large-example.tex @@ -1,6 +1,6 @@ % !TeX program = xelatex % Note: Requires photo.png in same directory -\documentclass[photoscale=4]{businesscard-qrcode} +\documentclass[bgscale=1.2,bgopacity=0.6,qrbgopacity=0.8,photoscale=4]{businesscard-qrcode} \type{home} \givennames{Max} @@ -13,6 +13,7 @@ \phone{+41 52 123 45 67} \email{max@example.ch} \photo{photo.png} +\background{background.png} \begin{document} \drawcard