Add fabric print variant with black replaced by dark grey
When printing on light fabric, solid black bleeds out, making QR codes
hard to scan and text fuzzy. ci/pdf-lighten-black rewrites all vector
pure black in a finished PDF to a dark grey (default 15%, configurable)
via a qpdf QDF round-trip: text and vector graphics stay vector and
embedded raster images are untouched. The CI now additionally produces
target/skeleton_fabric.pdf.
Ported from the DeLiKo@DNB poster project.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Change-Id: I594a1a813284e8d4f9d6c3a97f0d3d56c36162a6
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 63cd7ee..fc45c35 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -145,7 +145,7 @@
- start_section install_linux_packages "Installing missing Linux packages"
- mkdir -pv $APT_CACHE_DIR ccache $R_LIBS_USER
- apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 update
- - apt-get install --no-install-recommends -o dir::cache::archives="$APT_CACHE_DIR" -y libasound2t64 npm curl ccache libvulkan1 libu2f-udev fonts-liberation build-essential libglpk40 libcurl4-gnutls-dev libxml2-dev libsodium-dev libsecret-1-dev libfontconfig1-dev libssl-dev libxt6 libpq-dev imagemagick ghostscript inkscape scour poppler-utils fonts-stix
+ - apt-get install --no-install-recommends -o dir::cache::archives="$APT_CACHE_DIR" -y libasound2t64 npm curl ccache libvulkan1 libu2f-udev fonts-liberation build-essential libglpk40 libcurl4-gnutls-dev libxml2-dev libsodium-dev libsecret-1-dev libfontconfig1-dev libssl-dev libxt6 libpq-dev imagemagick ghostscript inkscape scour poppler-utils qpdf fonts-stix
# The distro Node (18, EOL) is too old for current tooling. Install the
# current Node.js LTS (24.x) from the official tarball into /usr/local, which
# precedes /usr/bin on PATH so `node`/`npx` resolve to it. We deliberately do
@@ -197,6 +197,9 @@
- export HTML=target/$(basename $SOURCE_FILE .Rmd).html
- export PDF=target/$(basename $SOURCE_FILE .Rmd).pdf
- ./ci/html2pdf $HTML $PDF 1
+ # Variant for printing on fabric, where solid black bleeds out: replace all
+ # vector black by 15% grey (keeps QR codes scannable and text crisp).
+ - ./ci/pdf-lighten-black $PDF target/$(basename $SOURCE_FILE .Rmd)_fabric.pdf
- gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -sPAPERSIZE=a1 -dFIXEDMEDIA -dPDFFitPage -sOutputFile=target/$(basename $SOURCE_FILE .Rmd)_a1.pdf $PDF
- inkscape -b white --pdf-poppler -o $SVG $PDF || true
- scour -i $SVG -o target/skeleton_optimized.svg --enable-viewboxing --enable-id-stripping --shorten-ids --indent=none