我希望有一个 PDF 文件,可以将其嵌入到 PDF 文件的前台,反过来,它会用可见的水印标记模拟副本。显然,这些被称为虚空受电弓有些打印机甚至可以将它们放在任何打印的页面上 - 而我的打印机不能。
为此,似乎可行的方法是获得两个微点半色调图像,其中底层图像的频率与呈现文本的频率不同。
首先,有没有办法生成一个包含特定大小和特定距离的微点的 PostScript 文件?然后,我将其中一个导入矢量编辑器,屏蔽我的文本并将其覆盖到另一个不同半色调频率的副本上,将两者合并,并将其添加到我要保护的页面顶部。呼。
换句话说,有没有一种方法可以通过 LaTeX 编程生成具有可调点大小、点颜色和频率的 Void Pantograph,而无需上述操作?
答案1
这是使用 TikZ 的解决方案。
编辑:我在下面添加了两个额外的解决方案。它们的优点是它们可以覆盖整个页面而不会出现内存问题。
编辑2:在最后添加了使用示例(根据 lAtExFaN 的要求)。
步骤1:画点,直接的方法。
\foreach \x in {0,...,50}{%
\typeout{line \x}% showing progress
\foreach \y in {0,...,50}{%
\draw (\x*1mm,\y*1mm) circle (0.1mm);
}
}
这1mm
是点距,0.1mm
这是点大小。
这会给 TeX 的主内存带来巨大负担(100 x 100TeX memory exceeded
在此处以错误结尾),并且编译需要很长时间。可以通过绘制短线而不是圆圈来优化。对于微点来说,这应该无关紧要。
\foreach \x in {0,...,100}{%
\typeout{line \x}% showing progress
\foreach \y in {0,...,100}{%
\draw[line width=0.1m]
(\x*1mm,\y*1mm-0.5*0.1mm) -- (\x*1mm,\y*1mm+0.5*0.1mm);
}
}
内存负担仍然很大(但 100 x 100 在这里有效)。因此,除非 TeX 的内存扩大,否则可能无法覆盖整个页面。但这种方法的优点是可以将点随机化。
图片中的红色和蓝色方块仅用于测试,背景中的东西并没有被遮盖住。
第2步:使点随机化。
\foreach \x in {0,...,100}{%
\typeout{line \x}% showing progress
\foreach \y in {0,...,100}{%
\pgfmathparse{rand}
\pgfmathsetmacro{\drandx}{\pgfmathresult}
\pgfmathparse{rand}
\pgfmathsetmacro{\drandy}{\pgfmathresult}
\pgfmathsetlength{\dotx}{(\x+0.25*\drandx)*1mm}
\pgfmathsetlength{\doty}{(\y+0.25*\drandy)*1mm}
\draw[line width=0.1mm] (\dotx,\doty-0.5*0.1mm) -- (\dotx,\doty+0.5*0.1mm);
}
}
当然,这需要更长的时间来编译。
让它变得非常快:
如果不需要随机化,使用虚线图案可以更快地绘制点。这也仅使用以前方法的十分之一的内存。
\draw[dash pattern=on 0.1mm off 0.9mm,dash phase=0.5*1mm,line width=0.1mm]
foreach \y in {0,...,100}{ (0,\y*1mm) -- (100mm,\y*1mm) };
这里的长度on
为off
应加起来等于所需的点距。
这里的一个问题是,对于较小的点距离,我的旧 Acrobat Reader 会显示线条而不是点。
步骤3:删除文本。
为此,transparency group=knockout
使用。这可能不会显示在某些 PDF 查看器中(但 Acrobat Reader 可以工作)。至于打印,当然取决于使用的打印机/打印机驱动程序。
\begin{scope}[transparency group=knockout]
\draw[dash pattern=on 0.1mm off 0.9mm,dash phase=0.5*1mm,line width=0.1mm]
foreach \y in {0,...,100}{ (0,\y*1mm) -- (100mm,\y*1mm) };
\node[scale=10, text opacity=0,rotate=45] at (0,0) {\sffamily\bfseries Test};
\end{scope}
步骤4:由点组成的文本。
这使用了fadings
图书馆(在这个答案)。
\begin{tikzfadingfrompicture}[name=A]
\node[scale=10,rotate=45, transparent!0] at (0,0) {\sffamily\bfseries Test};
\end{tikzfadingfrompicture}% Edit: get rid of this space
\begin{tikzpicture}
\draw[path fading=A,fit fading=false,dash pattern=on 0.2mm off 0.8mm,dash phase=0.5*1mm,line width=0.2mm]
foreach \y in {-50,...,50}{ (-50mm,\y*1mm) -- (50mm,\y*1mm) };
\end{tikzpicture}
注意这里\y
是从 -50 到 50 计数的,因为淡入淡出的图片以原点为中心。由于后者是一张单独的图片,因此必须这样做才能确保正确定位。
步骤5:把它们放在一起。
\begin{tikzfadingfrompicture}[name=A]
\node[scale=10,rotate=45, transparent!0] at (0,0) {\sffamily\bfseries Test};
\end{tikzfadingfrompicture}% Edit: get rid of this space
\begin{tikzpicture}
\begin{scope}[transparency group=knockout]
\draw[dash pattern=on 0.1mm off 0.9mm,dash phase=0.5*1mm,line width=0.1mm]
foreach \y in {-50,...,50}{ (-50,\y*1mm) -- (50mm,\y*1mm) };
\node[scale=10, text opacity=0,rotate=45] at (0,0) {\sffamily\bfseries Test};
\end{scope}
\draw[path fading=A,fit fading=false,dash pattern=on 0.2mm off 0.8mm,dash phase=0.5*1mm,line width=0.2mm]
foreach \y in {-35,...,35}{ (-35mm,\y*1mm) -- (35mm,\y*1mm) };
\end{tikzpicture}
对于无法显示的查看器transparency group=knockout
,如果使用随机化,背景的点将显示在文本的点之间。
为了节省内存和编译时间,建议使第二个点光栅尽可能小,这样它刚好覆盖文本。
(预测您的下一个问题,这里有一些关于如何扩大 TeX 内存的答案:回答一和回答二。
最后:让我们用一些键创建一些宏。
\dotpattern
以较慢的方式绘制点光栅。
\dotfast
也绘制点光栅,但是速度很快。
\dotrandom
绘制随机点光栅。
\dotfastfade
,与\dotrandomfade
上文相同,但用于文本。没有\dotpatternfade
,因为\dotfastfade
功能相同,但速度更快。
这些宏可以使用以下键作为可选参数
dot color
设置点的颜色(例如dot color=red
,默认值:黑色)。
dot distance
设置点之间的距离,必须是长度(例如dot distance=2mm
,默认值:1mm)。
dot size
再次设置点的大小,必须是长度(例如dot size=0.2mm
,默认值:0.1mm)。
dot number x
设置 x 方向上的点数(例如,dot number x=50', default: 100). The horizontal size of the area covered is determined by
点距times
点数 x`。
dot number y
设置 y 方向上的点数(例如,dot number y=50', default: 100). The vertical size of the area covered is determined by
点距times
点数 y`。
dot random shift ratio
设置点在 x 和 y 方向上相对于其标称位置的最大偏移量,作为点距离的分数(仅适用于\dotrandom
和\dotrandomfade
,例如dot random shift ratio=0.3
,默认值:0.25)。
这是一个完整的例子:
\documentclass[10pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{fadings}
\newdimen\dotdist
\newdimen\dotsize
\newdimen\dotx
\newdimen\doty
% defaults
\dotdist=1mm
\dotsize=0.1mm
\newcommand*{\dotstartx}{-50}
\newcommand*{\dotstarty}{-50}
\newcommand*{\dotendx}{50}
\newcommand*{\dotendy}{50}
\newcommand*{\dotshiftratio}{0.25}
\newcommand*{\dotcolor}{black}
\tikzset{%
dot distance/.code={\dotdist=#1},
dot distance/.value required,
dot size/.code={\dotsize=#1},
dot size/.value required,
dot number x/.code={\pgfmathparse{int(#1/2)}\edef\dotstartx{-\pgfmathresult}\edef\dotendx{\pgfmathresult}},
dot number x/.value required,
dot number y/.code={\pgfmathparse{int(#1/2)}\edef\dotstarty{-\pgfmathresult}\edef\dotendy{\pgfmathresult}},
dot number y/.value required,
dot random shift ratio/.code={\def\dotshiftratio{#1}},
dot random shift ratio/.value required,
dot color/.code={\def\dotcolor{#1}}
}
\newcommand*{\dotfast}[1][]{%
\tikzset{#1}
\draw[draw=\dotcolor,dash pattern=on \dotsize off \dimexpr\dotdist-\dotsize,dash phase=0.5\dotsize,line width=\dotsize]
foreach \y in {\dotstarty,...,\dotendy}{ (\dotstartx*\dotdist,\y*\dotdist) -- (\dotendx*\dotdist,\y*\dotdist) };
}
\newcommand*{\dotfastfade}[1][]{%
\tikzset{#1}
\draw[path fading=A,fit fading=false,draw=\dotcolor,
dash pattern=on \dotsize off \dimexpr\dotdist-\dotsize,dash phase=0.5\dotsize,line width=\dotsize]
foreach \y in {\dotstarty,...,\dotendy}{ (\dotstartx*\dotdist,\y*\dotdist) -- (\dotendx*\dotdist,\y*\dotdist) };
}
\newcommand*{\dotpattern}[1][]{%
\tikzset{#1}
\foreach \x in {\dotstartx,...,\dotendx}{%
\typeout{line \x}% showing progress
\foreach \y in {\dotstarty,...,\dotendy}{%
\draw[draw=\dotcolor,line width=\dotsize]
(\x*\dotdist,\y*\dotdist-0.5*\dotsize) -- (\x*\dotdist,\y*\dotdist+0.5*\dotsize);
}
}
}
\newcommand{\dotrandom}[1][]{%
\tikzset{#1}
\foreach \x in {\dotstartx,...,\dotendx}{%
\typeout{line \x}% showing progress
\foreach \y in {\dotstarty,...,\dotendy}{%
\pgfmathparse{rand}
\pgfmathsetmacro{\drandx}{\pgfmathresult}
\pgfmathparse{rand}
\pgfmathsetmacro{\drandy}{\pgfmathresult}
\pgfmathsetlength{\dotx}{(\x+\dotshiftratio*\drandx)*\dotdist}
\pgfmathsetlength{\doty}{(\y+\dotshiftratio*\drandy)*\dotdist}
\draw[draw=\dotcolor,line width=\dotsize] (\dotx,\doty-0.5*\dotsize) -- (\dotx,\doty+0.5*\dotsize);
}
}
}
\newcommand{\dotrandomfade}[1][]{%
\tikzset{#1}
\foreach \x in {\dotstartx,...,\dotendx}{%
\typeout{line \x}% showing progress
\foreach \y in {\dotstarty,...,\dotendy}{%
\pgfmathparse{rand}
\pgfmathsetmacro{\drandx}{\pgfmathresult}
\pgfmathparse{rand}
\pgfmathsetmacro{\drandy}{\pgfmathresult}
\pgfmathsetlength{\dotx}{(\x+\dotshiftratio*\drandx)*\dotdist}
\pgfmathsetlength{\doty}{(\y+\dotshiftratio*\drandy)*\dotdist}
\draw[path fading=A,fit fading=false,draw=\dotcolor,line width=\dotsize]
(\dotx,\doty-0.5*\dotsize) -- (\dotx,\doty+0.5*\dotsize);
}
}
}
\begin{document}
\section*{Step 1:}
creating the dots, straight forward approach, but takes long and needs a lot of memory
\vspace{1cm}
\noindent
\begin{tikzpicture}
% stuff below, for testing
\fill[blue!20] (-2,-2) rectangle (0,0);
\fill[red!20] (0,0) rectangle (2,2);
% the dots
\dotpattern[dot distance=2mm,dot size=0.2mm,dot number x=50,dot number y=50]
\end{tikzpicture}
\newpage
\section*{Step 2:}
randomize the dots a little, takes a bit longer
\vspace{1cm}
\noindent
\begin{tikzpicture}
% stuff below, for testing
\fill[blue!20] (-2,-2) rectangle (0,0);
\fill[red!20] (0,0) rectangle (2,2);
% the dots
\dotrandom[dot distance=2mm,dot size=0.2mm,dot number x=50,dot number y=50]
\end{tikzpicture}
\newpage
\section*{Fast dots:}
use line patterns to create dots, fast, nearly no memory, but can't be randomized
\vspace{1cm}
\noindent
\begin{tikzpicture}
% stuff below, for testing
\fill[blue!20] (-2,-2) rectangle (0,0);
\fill[red!20] (0,0) rectangle (2,2);
% the dots
\dotfast[dot distance=2mm,dot size=0.2mm,dot number x=50,dot number y=50]
\end{tikzpicture}
\newpage
\section*{Step 3:}
stamp out the text, will not show with all viewers (Acrobat Reader works)
\vspace{1cm}
\noindent
\begin{tikzpicture}
% stuff below, for testing
\fill[blue!20] (-2,-2) rectangle (0,0);
\fill[red!20] (0,0) rectangle (2,2);
% the dots
\begin{scope}[transparency group=knockout]
\dotfast[dot distance=2mm,dot size=0.2mm,dot number x=50,dot number y=50]
\node[scale=10, text opacity=0,rotate=45] at (0,0) {\sffamily\bfseries Test};
\end{scope}
\end{tikzpicture}
\newpage
\section*{Step 4:}
text made out of dots, uses fadings library
\vspace{1cm}
\noindent
\begin{tikzfadingfrompicture}[name=A]
\node[scale=10,rotate=45, transparent!0] at (0,0) {\sffamily\bfseries Test};
\end{tikzfadingfrompicture}% Edit: get rid of this space
\begin{tikzpicture}
% stuff below, for testing
\fill[blue!20] (-2,-2) rectangle (0,0);
\fill[red!20] (0,0) rectangle (2,2);
% the dots
\dotfastfade[dot distance=2mm,dot size=0.4mm,dot number x=50,dot number y=50]
\end{tikzpicture}
\newpage
\section*{Step 5:}
putting it all together
\vspace{1cm}
\noindent
% Edit: this is only needed once in the document
%\begin{tikzfadingfrompicture}[name=A]
%\node[scale=10,rotate=45, transparent!0] at (0,0) {\sffamily\bfseries Test};
%\end{tikzfadingfrompicture}% Edit: get rid of this space
\begin{tikzpicture}
% stuff below, for testing
\fill[blue!20] (-2,-2) rectangle (0,0);
\fill[red!20] (0,0) rectangle (2,2);
% the dots
\begin{scope}[transparency group=knockout]
\dotfast[dot distance=2mm,dot size=0.2mm,dot number x=50,dot number y=50]
\node[scale=10, text opacity=0,rotate=45] at (0,0) {\sffamily\bfseries Test};
\end{scope}
\dotfastfade[dot distance=2mm,dot size=0.4mm,dot number x=50,dot number y=50]
\end{tikzpicture}
\newpage
\section*{Nice Version:}
all together, with random dots
\vspace{1cm}
\noindent
% Edit: this is only needed once in the document
%\begin{tikzfadingfrompicture}[name=A]
%\node[scale=10,rotate=45, transparent!0] at (0,0) {\sffamily\bfseries Test};
%\end{tikzfadingfrompicture}% Edit: get rid of this space
\begin{tikzpicture}
% stuff below, for testing
\fill[blue!20] (-2,-2) rectangle (0,0);
\fill[red!20] (0,0) rectangle (2,2);
% the dots
\begin{scope}[transparency group=knockout]
\dotrandom[dot color=teal,dot distance=2mm,dot size=0.2mm,dot number x=50,dot number y=50]
\node[scale=10, text opacity=0,rotate=45] at (0,0) {\sffamily\bfseries Test};
\end{scope}
\dotrandomfade[dot color=magenta,dot size=0.2mm,dot number x=70,dot number y=70,dot random shift ratio=0.3]
\end{tikzpicture}
\end{document}
编辑:这是一个使用模式的解决方案。
主要优点是,它可以覆盖整个页面,而不会出现内存问题(只有中等负担)。缺点是图案的图块之间存在间隙和线条伪影,当然图案会重复。哦,第一页的编译时间相当长。但后续页面的编译速度要快得多。
构造(使用transparency group=knockout
和淡出)与第一个解决方案相同。因此,对查看器和打印的限制也相同。
这里第一个解决方案的选项也可用于设置点光栅。
代码:
\documentclass[a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{fadings}
\newdimen\dotdist
\newdimen\dotsize
\newdimen\dotx
\newdimen\doty
% defaults
\dotdist=1mm
\dotsize=0.1mm
\tikzset{%
dot distance/.code={\dotdist=#1},
dot size/.code={\dotsize=#1},
dot number x/.store in=\dotnumx,
dot number y/.store in=\dotnumy,
dot random shift ratio/.store in=\dotshiftratio,
dot color/.store in=\dotcolor,
%
dot distance/.value required,
dot size/.value required,
dot number x/.value required,
dot number y/.value required,
dot random shift ratio/.value required,
% set defaults
dot distance=1mm,
dot size=0.1mm,
dot number x=50,
dot number y=50,
dot random shift ratio=0.25,
dot color=black
}
\pgfdeclarepatternformonly[\dotdist,\dotsize,\dotnumx,\dotnumy,\dotshiftratio,\dotcolor]{dotsrandom}
% slightly overlap, creates line artefacts
%{\pgfpoint{-\dotshiftratio*\dotdist}{-\dotshiftratio*\dotdist}}
%{\pgfpoint{(\dotnumx+\dotshiftratio)*\dotdist}{(\dotnumy+\dotshiftratio)*\dotdist}}
% no overlap, can create gap and line artefacts, but seems better
{\pgfpointorigin}
{\pgfpoint{\dotnumx*\dotdist}{\dotnumy*\dotdist}}
{\pgfpoint{\dotnumx*\dotdist}{\dotnumy*\dotdist}}
{
\pgfsetlinewidth{\dotsize}
\pgfsetstrokecolor{\dotcolor}
\foreach \x in {0,...,\dotnumx}{%
\typeout{line \x}% showing progress
\foreach \y in {0,...,\dotnumy}{%
\pgfmathparse{rand}
\pgfmathsetmacro{\drandx}{\pgfmathresult}
\pgfmathparse{rand}
\pgfmathsetmacro{\drandy}{\pgfmathresult}
\pgfmathsetlength{\dotx}{(\x+\dotshiftratio*\drandx)*\dotdist}
\pgfmathsetlength{\doty}{(\y+\dotshiftratio*\drandy)*\dotdist}
\pgfpathmoveto{\pgfpoint{\dotx}{\doty-0.5*\dotsize}}
\pgfpathlineto{\pgfpoint{\dotx}{\doty+0.5*\dotsize}}
\pgfusepath{stroke}
}
}
}
\begin{document}
\noindent
\begin{tikzfadingfrompicture}[name=A]
\node[scale=15,rotate=45, transparent!0,inner sep=0pt] at (0,0) {\sffamily\bfseries Test};
\end{tikzfadingfrompicture}%
\begin{tikzpicture}
% stuff below, for testing
\fill[blue!20] (-2,-2) rectangle (0,0);
\fill[red!20] (0,0) rectangle (2,2);
% the dots
\begin{scope}[transparency group=knockout]
\fill[pattern=dotsrandom,dot color=red,dot size=0.2mm] (-0.5\textwidth,-0.5\textheight) rectangle (0.5\textwidth,0.5\textheight);
\node[scale=15, text opacity=0,rotate=45,inner sep=0pt] at (0,0) {\sffamily\bfseries Test};
\end{scope}
\fill[path fading=A,fit fading=false,pattern=dotsrandom,dot color=blue,dot size=0.1mm,dot distance=0.5mm]
(-0.5\textwidth,-0.5\textheight) rectangle (0.5\textwidth,0.5\textheight);
\end{tikzpicture}
\end{document}
另一个想法是:使用几乎透明的填充矩形。
再次,其构造与第一个解决方案相同。
这里没有控制点大小和距离的控制。在查看器中,矩形可能是可见的,具体取决于它们的不透明度。对于打印,外观完全取决于打印机/打印机驱动程序。但内存或编译时间完全没有问题。
代码:
\documentclass[10pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{fadings}
\begin{document}
\section*{With transparent rectangles:}
Disadvantages are: no control over dot size and distance, rectangles visible
on screen, and printout always depends on printer / printer driver.
\vspace{1ex}
\noindent
Advantages: no memory problems, fast compiling.
\vspace{1cm}
\noindent
\begin{tikzfadingfrompicture}[name=A]
\node[scale=10,rotate=45, transparent!0] at (0,0) {\sffamily\bfseries Test};
\end{tikzfadingfrompicture}
\begin{tikzpicture}
% stuff below, for testing
\fill[blue!20] (-2,-2) rectangle (0,0);
\fill[red!20] (0,0) rectangle (2,2);
% the dots
\begin{scope}[transparency group=knockout]
\fill[blue,opacity=0.1] (-5,-5) rectangle (5,5);
\node[scale=10, text opacity=0,rotate=45] at (0,0) {\sffamily\bfseries Test};
\end{scope}
\fill[path fading=A,fit fading=false,red,opacity=0.1] (-5,-5) rectangle (5,5);
\end{tikzpicture}
\end{document}
编辑2:使用示例。
以下是使用示例,使用该eso-pic
包将点光栅置于前景中。这里的点故意太大,所以它们显示在屏幕上。对于实际使用,必须选择点的大小、距离和颜色,以便它们在屏幕上(几乎)不可见,但显示在打印输出上。这可能取决于使用的打印机/打印机驱动程序。
注意:这里必须更改定义\VoidPantograph
来设置点,因为主光栅和文本光栅使用相同的选项。
\documentclass[a4paper]{article}
\usepackage{eso-pic}
\usepackage{tikz}
\usetikzlibrary{patterns}
\usetikzlibrary{fadings}
\usepackage{lipsum}
\newdimen\dotdist
\newdimen\dotsize
\newdimen\dotx
\newdimen\doty
% defaults
\dotdist=1mm
\dotsize=0.1mm
\tikzset{%
dot distance/.code={\dotdist=#1},
dot size/.code={\dotsize=#1},
dot number x/.store in=\dotnumx,
dot number y/.store in=\dotnumy,
dot random shift ratio/.store in=\dotshiftratio,
dot color/.store in=\dotcolor,
%
dot distance/.value required,
dot size/.value required,
dot number x/.value required,
dot number y/.value required,
dot random shift ratio/.value required,
% set defaults
dot distance=1mm,
dot size=0.1mm,
dot number x=50,
dot number y=50,
dot random shift ratio=0.25,
dot color=black
}
\pgfdeclarepatternformonly[\dotdist,\dotsize,\dotnumx,\dotnumy,\dotshiftratio,\dotcolor]{dotsrandom}
% slightly overlap, creates line artefacts
%{\pgfpoint{-\dotshiftratio*\dotdist}{-\dotshiftratio*\dotdist}}
%{\pgfpoint{(\dotnumx+\dotshiftratio)*\dotdist}{(\dotnumy+\dotshiftratio)*\dotdist}}
% no overlap, can create gap and line artefacts, but seems better
{\pgfpointorigin}
{\pgfpoint{\dotnumx*\dotdist}{\dotnumy*\dotdist}}
{\pgfpoint{\dotnumx*\dotdist}{\dotnumy*\dotdist}}
{
\pgfsetlinewidth{\dotsize}
\pgfsetstrokecolor{\dotcolor}
\foreach \x in {0,...,\dotnumx}{%
\typeout{line \x}% showing progress
\foreach \y in {0,...,\dotnumy}{%
\pgfmathparse{rand}
\pgfmathsetmacro{\drandx}{\pgfmathresult}
\pgfmathparse{rand}
\pgfmathsetmacro{\drandy}{\pgfmathresult}
\pgfmathsetlength{\dotx}{(\x+\dotshiftratio*\drandx)*\dotdist}
\pgfmathsetlength{\doty}{(\y+\dotshiftratio*\drandy)*\dotdist}
\pgfpathmoveto{\pgfpoint{\dotx}{\doty-0.5*\dotsize}}
\pgfpathlineto{\pgfpoint{\dotx}{\doty+0.5*\dotsize}}
\pgfusepath{stroke}
}
}
}
% #1: scale for text, optional, default: 15
% #2: text
\newcommand*{\VoidPantograph}[2][15]{%
\begin{tikzfadingfrompicture}[name=A]
\node[scale=#1,rotate=45, transparent!0,inner sep=0pt] at (0,0) {#2};
\end{tikzfadingfrompicture}%
\begin{tikzpicture}
\begin{scope}[transparency group=knockout]
\fill[pattern=dotsrandom,dot color=red,dot size=0.2mm]
(-0.5\paperwidth,-0.5\paperheight) rectangle (0.5\paperwidth,0.5\paperheight);
\node[scale=#1, text opacity=0,rotate=45,inner sep=0pt] at (0,0) {#2};
\end{scope}
\fill[path fading=A,fit fading=false,pattern=dotsrandom,dot color=blue,dot size=0.1mm,dot distance=0.5mm]
(-0.5\paperwidth,-0.5\paperheight) rectangle (0.5\paperwidth,0.5\paperheight);
\end{tikzpicture}
}
\AddToShipoutPictureFG{\VoidPantograph{\sffamily\bfseries Test}}
\begin{document}
\noindent
\begin{center}
\Huge\sffamily\bfseries
Example of Usage
\vspace{1cm}
\begin{tikzpicture}
\fill[blue!20] (-2,-2) rectangle (0,0);
\fill[red!20] (0,0) rectangle (2,2);
\end{tikzpicture}
\end{center}
\vspace{1cm}
\noindent
The dots here are of course too big. But for this example they should be
visible on screen. The goal is to select dot size, distance and color,
so the raster is nearly invisible on screen, but shows up on a printout.
\section{Some Text}
\lipsum
\end{document}