5

I'm interested in finding a better method for the following:

  • creating a black mask over the images on all pages
  • while removing (or covering with white) all the text and other elements
  • but still allowing memoir to produce its trim marks with showtrim.

This is used for printing a glossy varnish layer over the images (where the black mask is). Some printers call this a "UV mask".

Before and after:

before and after

For this, I did:

  1. replace the image files with .pdf files that are black squares of the same size as the corresponding images
  2. make a copy of the .tex files and delete all text
  3. insert \hspace and other commands to get the \includegraphics stay at the same position

This worked once, but it would be much better to find a less hack-ish method.

Perhaps somehow saving the position and size of the images, covering the page with a white square and placing rectangles at the position of the images? Who knows.

Can you think of a good method? Ideally something that could be then abstracted into a document class option [varnishmask=true] or similar.

Gambhiro
  • 3,384

2 Answers2

1

This is only a partial answer, but:

  1. Converting all images to black rectangles is the easy part, actually: just say \usepackage[demo]{graphicx}. This is obviously meant for something different, but should work here fine.

  2. For text, I'd try Nils L's suggestion in the comment (\color{white}). If this won't work, I'd be looking into the chickenize package (with LuaLaTeX). If you can't use LuaLaTeX (because e.g. you use some package which doesn't work with LuaLateX), my third try would be to something like silently converting (temporarily) all the fonts to "white" (i.e., without anything actually printed) counterparts, but preserving .tfm files (so that typesetting is the same).

mbork
  • 13,385
  • \color{white} is great visually, but can you think of a way that it might produce stray artifacts on letter edges when the PDF is interpreted by a printer? This might be a non-issue, I'm just thinking that after all the text is still there, and cause problems at some low-level font rendering stage. – Gambhiro Mar 25 '13 at 21:17
  • @Nyiti: I'd be surprised if it did leave any such artifacts, but I'm not 100% sure - you'd probably have to check it or ask some pdf expert;). – mbork Mar 26 '13 at 01:06
0

It seems that implementing a general-purpose solution would be rather complicated (vonbrand suggests that the beamer package has some mechanism to make text "disappear").

I ended up using just a conditional \ifvarnishmask and a \placeholder command, not so generalized but still allows to produce two versions of the same document simply by changing the conditional.

before and after

\documentclass[10pt]{article}

\makeatletter

\usepackage{geometry}
\geometry{paperwidth=70mm, paperheight=100mm, vmargin=3mm, hmargin=5mm, nohead, nofoot}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}

% Toggle normal or varnish mask version
\newif\ifvarnishmask
\varnishmasktrue
%\varnishmaskfalse

\usepackage{graphicx}
\usepackage{calc}
\usepackage{xcolor}

\newlength\tmp@height
\newlength\tmp@width

% #1 -- color of rectangle (optional, default white)
% #2 -- text or \includegraphics command
\newcommand\placeholder[2][white]{
\ifvarnishmask
\settowidth{\tmp@width}{#2}
\settototalheight{\tmp@height}{#2}
{\color{#1}\rule{\tmp@width}{\tmp@height}}%
\else
#2
\fi
}

\pagestyle{empty}

\makeatother

\begin{document}

{\centering

\placeholder{%
\begin{minipage}{\linewidth}
\begin{verse}
\ldots\\
And I struggle and shriek ere the daybreak, being driven to madness with fright.\\
\emph{Nemesis, H.P. Lovecraft}
\end{verse}
\end{minipage}
}

\bigskip

\placeholder[black]{%
\includegraphics[keepaspectratio, height=5cm]{the-scream.jpg}
}

}

\end{document}
David Carlisle
  • 757,742
Gambhiro
  • 3,384