diff --git a/README.md b/README.md index 1a5f327..20ab926 100644 --- a/README.md +++ b/README.md @@ -5,9 +5,9 @@ What happens, if you give your visiting card to someone? Either he manually type Other available visitingcard templates, such as [mschlenker] distribute the cards on an A4 paper. But if you want a professional printer, such as [onlineprinters], then you need to be able to generate a PDF with exactly one card, an exactly defined border and crop marks. -[![Example: John Doe from Hongkong](screenshots/john-doe-hongkong.jpg)](examples/john-doe-hongkong.tex) -[![Example: Businesscard of Peter Muster from Zürich](screenshots/peter-muster-example-company-zuerich.jpg)](examples/peter-muster-example-company-zuerich.tex) -[![Example: Nearly Real Examle Of My Card](screenshots/example.jpg)](examples/example.tex) +[![Example: John Doe from Hongkong](screenshots/john-doe-hongkong.png)](examples/john-doe-hongkong.tex) +[![Example: Businesscard of Peter Muster from Zürich](screenshots/peter-muster-example-company-zuerich.png)](examples/peter-muster-example-company-zuerich.tex) +[![Example: Nearly Real Examle Of My Card](screenshots/example.png)](examples/example.tex) Features @@ -174,7 +174,7 @@ The card is designed for professional printing service, such as [onlineprinters] cutdist=2] {businesscard-qrcode} -![example with special paper size](screenshots/special-papersize.jpg) +![example with special paper size](screenshots/special-papersize.png) Usage Example @@ -204,7 +204,7 @@ Save it as file [texstudio_d30266.tex] and compile it to get [texstudio_d30266.p xelatex -synctex=1 -interaction=nonstopmode texstudio_d30266.tex -![the visiting card resulting from the usage example](screenshots/texstudio_d30266.jpg) +![the visiting card resulting from the usage example](screenshots/texstudio_d30266.png) See [examples] for more examples. @@ -214,7 +214,7 @@ Photo (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). ```latex -\photo{path/to/photo.jpg} +\photo{path/to/photo.png} ``` ### Photo Placement Options: @@ -222,13 +222,13 @@ You can add an optional photo that appears next to the name or in the center of **Default (photo next to name):** ```latex \documentclass{businesscard-qrcode} -\photo{photo.jpg} +\photo{photo.png} ``` **Photo in QR code center:** ```latex \documentclass[photoinqr,qreclevel=H,qrlogoscale=0.25]{businesscard-qrcode} -\photo{photo.jpg} +\photo{photo.png} ``` **Important:** When using `photoinqr=true`: @@ -241,7 +241,7 @@ You can add an optional photo that appears next to the name or in the center of **Large photo next to name:** ```latex \documentclass[photoscale=2.5]{businesscard-qrcode} -\photo{photo.jpg} +\photo{photo.png} ``` **Background color:** @@ -253,7 +253,7 @@ You can add an optional photo that appears next to the name or in the center of **Background image:** ```latex \documentclass[bgscale=1.5,bgopacity=0.3,qrbgopacity=1.0]{businesscard-qrcode} -\background{photo.jpg} +\background{photo.png} ``` Note: Use `bgopacity` to fade the background (e.g., `0.2` or `0.3`) so text remains readable. The QR code has a white background by default (`qrbgopacity=1.0`) to ensure scannability. diff --git a/businesscard-qrcode.cls b/businesscard-qrcode.cls index 5509de3..2d5dd76 100644 --- a/businesscard-qrcode.cls +++ b/businesscard-qrcode.cls @@ -80,6 +80,8 @@ \RequirePackage{graphicx} % needed for optional photo \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 +\DeclareHookRule{shipout/background}{pgfrcs}{>}{eso-pic} \RequirePackage[\content,top=\padding,left=\padding,right=\padding,bottom=\padding]{geometry} %\RequirePackage{pbox} \RequirePackage{varwidth} @@ -383,15 +385,15 @@ END:VCARD\BCQ@nl} \ifcsdef{Xbackground}{% \IfFileExists{\Xbackground}{% % It's an image file: add to background using eso-pic (no layout impact) - % 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}% - };}% + \AddToShipoutPictureBG*{% + \AtPageCenter{% + \begin{tikzpicture}[overlay] + \node[inner sep=0pt, opacity=\fpeval{\BCQ@bgopacity}] at (0,0) {% + \includegraphics[height=\fpeval{\BCQ@bgscale}\paperheight]{\Xbackground}% + }; + \end{tikzpicture}% }% }% - \DeclareHookRule{shipout/background}{pgfrcs}{>}{businesscard}% }{% % Not a file: treat as color \pagecolor{\Xbackground}% diff --git a/examples/background-color-example.pdf b/examples/background-color-example.pdf index 855f1e2..10e6c60 100644 Binary files a/examples/background-color-example.pdf and b/examples/background-color-example.pdf differ diff --git a/examples/background-image-example.pdf b/examples/background-image-example.pdf index 269a47b..429445e 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 a303aa2..9ce77c6 100644 --- a/examples/background-image-example.tex +++ b/examples/background-image-example.tex @@ -4,6 +4,7 @@ \type{home} \givennames{Petra} \familynames{Test} +\additionalnames{Example Company Ltd.} \street{Bildstrasse\ 99} \city{Basel} \zip{4000} diff --git a/examples/example.pdf b/examples/example.pdf index e6bbc34..2810671 100644 Binary files a/examples/example.pdf and b/examples/example.pdf differ diff --git a/examples/john-doe-hongkong.pdf b/examples/john-doe-hongkong.pdf index 0ea3ce1..34b3ecf 100644 Binary files a/examples/john-doe-hongkong.pdf and b/examples/john-doe-hongkong.pdf differ diff --git a/examples/makefile.am b/examples/makefile.am index 54278db..fe4b78b 100644 --- a/examples/makefile.am +++ b/examples/makefile.am @@ -1,8 +1,20 @@ +EXAMPLES = example \ + john-doe-hongkong \ + peter-muster-example-company-zuerich \ + special-papersize \ + photo-example \ + photo-in-qr-example \ + photo-large-example \ + background-color-example \ + background-image-example \ + test-country-short \ + texstudio_d30266 + examplesdir = ${docdir}/examples dist_examples_DATA = $(EXAMPLES:%=%.tex) $(EXAMPLES:%=%.pdf) %.pdf:%.tex xelatex -synctex=1 -interaction=nonstopmode $< -CLEANFILES = $(EXAMPLES:%=%.aux) $(EXAMPLES:%=%.log) $(EXAMPLES:%=%.synctex.gz) +CLEANFILES = $(EXAMPLES:%=%.aux) $(EXAMPLES:%=%.log) $(EXAMPLES:%=%.synctex.gz) $(EXAMPLES:%=%.fdb_latexmk) $(EXAMPLES:%=%.fls) $(EXAMPLES:%=%.xdv) MAINTAINERCLEANFILES = makefile.in diff --git a/examples/peter-muster-example-company-zuerich.pdf b/examples/peter-muster-example-company-zuerich.pdf index e8cd182..9182f95 100644 Binary files a/examples/peter-muster-example-company-zuerich.pdf and b/examples/peter-muster-example-company-zuerich.pdf differ diff --git a/examples/photo-example.pdf b/examples/photo-example.pdf index d145fbc..4e7f04a 100644 Binary files a/examples/photo-example.pdf and b/examples/photo-example.pdf differ diff --git a/examples/photo-in-qr-example.pdf b/examples/photo-in-qr-example.pdf index d21dd68..3d34dad 100644 Binary files a/examples/photo-in-qr-example.pdf and b/examples/photo-in-qr-example.pdf differ diff --git a/examples/photo-large-example.pdf b/examples/photo-large-example.pdf index f534541..d1078d7 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 1d9fdd4..cb9079c 100644 --- a/examples/photo-large-example.tex +++ b/examples/photo-large-example.tex @@ -1,5 +1,3 @@ -% !TeX program = xelatex -% Note: Requires photo.png in same directory \documentclass[bgscale=1.2,bgopacity=0.6,qrbgopacity=0.8,photoscale=4]{businesscard-qrcode} \type{home} diff --git a/examples/special-papersize.pdf b/examples/special-papersize.pdf index 3cd5990..23bd05e 100644 Binary files a/examples/special-papersize.pdf and b/examples/special-papersize.pdf differ diff --git a/examples/test-country-short.pdf b/examples/test-country-short.pdf index 72f915d..6f67f55 100644 Binary files a/examples/test-country-short.pdf and b/examples/test-country-short.pdf differ diff --git a/examples/texstudio_d30266.pdf b/examples/texstudio_d30266.pdf index 66d13fe..c90270e 100644 Binary files a/examples/texstudio_d30266.pdf and b/examples/texstudio_d30266.pdf differ diff --git a/screenshots/example.jpg b/screenshots/example.jpg deleted file mode 100644 index 6a29694..0000000 Binary files a/screenshots/example.jpg and /dev/null differ diff --git a/screenshots/example.png b/screenshots/example.png new file mode 100644 index 0000000..b6e65ba Binary files /dev/null and b/screenshots/example.png differ diff --git a/screenshots/john-doe-hongkong.jpg b/screenshots/john-doe-hongkong.jpg deleted file mode 100644 index 62d436c..0000000 Binary files a/screenshots/john-doe-hongkong.jpg and /dev/null differ diff --git a/screenshots/john-doe-hongkong.png b/screenshots/john-doe-hongkong.png new file mode 100644 index 0000000..c3ce53c Binary files /dev/null and b/screenshots/john-doe-hongkong.png differ diff --git a/screenshots/makefile.am b/screenshots/makefile.am index 95b0fd7..bbd7451 100644 --- a/screenshots/makefile.am +++ b/screenshots/makefile.am @@ -1,7 +1,7 @@ screenshotdir=${docdir}/screenshots -dist_screenshot_DATA=$(EXAMPLES:%=%.jpg) +dist_screenshot_DATA=$(EXAMPLES:%=%.png) -%.jpg:${top_srcdir}/examples/%.pdf +%.png:${top_srcdir}/examples/%.pdf convert -density 200 -quality 90 $< $@ MAINTAINERCLEANFILES = makefile.in diff --git a/screenshots/peter-muster-example-company-zuerich.jpg b/screenshots/peter-muster-example-company-zuerich.jpg deleted file mode 100644 index 3d7da48..0000000 Binary files a/screenshots/peter-muster-example-company-zuerich.jpg and /dev/null differ diff --git a/screenshots/peter-muster-example-company-zuerich.png b/screenshots/peter-muster-example-company-zuerich.png new file mode 100644 index 0000000..df8cbc5 Binary files /dev/null and b/screenshots/peter-muster-example-company-zuerich.png differ diff --git a/screenshots/photo-example.jpg b/screenshots/photo-example.jpg deleted file mode 100644 index f576afd..0000000 Binary files a/screenshots/photo-example.jpg and /dev/null differ diff --git a/screenshots/photo-example.png b/screenshots/photo-example.png new file mode 100644 index 0000000..77cf97b Binary files /dev/null and b/screenshots/photo-example.png differ diff --git a/screenshots/photo-in-qr-example.jpg b/screenshots/photo-in-qr-example.jpg deleted file mode 100644 index bdfa8b1..0000000 Binary files a/screenshots/photo-in-qr-example.jpg and /dev/null differ diff --git a/screenshots/photo-in-qr-example.png b/screenshots/photo-in-qr-example.png new file mode 100644 index 0000000..1cb4a44 Binary files /dev/null and b/screenshots/photo-in-qr-example.png differ diff --git a/screenshots/special-papersize.jpg b/screenshots/special-papersize.jpg deleted file mode 100644 index 5ca1473..0000000 Binary files a/screenshots/special-papersize.jpg and /dev/null differ diff --git a/screenshots/special-papersize.png b/screenshots/special-papersize.png new file mode 100644 index 0000000..4f7cd89 Binary files /dev/null and b/screenshots/special-papersize.png differ diff --git a/screenshots/texstudio_d30266.jpg b/screenshots/texstudio_d30266.jpg deleted file mode 100644 index 0f62c41..0000000 Binary files a/screenshots/texstudio_d30266.jpg and /dev/null differ diff --git a/screenshots/texstudio_d30266.png b/screenshots/texstudio_d30266.png new file mode 100644 index 0000000..e307f7c Binary files /dev/null and b/screenshots/texstudio_d30266.png differ