Short answer: This is a feature of the
ps2pdf workflow and cannot be avoided in connection with the recent (v3.1.6) release of PGF and its
fadings TikZ libraries.
shadows library also loads the
Fadings, also known as transparency gradients or soft masks, are a PDF-only feature (as is basic, constant transparency too). Fadings have been made available for the DVI->PS->PDF route only recently (PGF-3.1.6). User- and pre-defined fadings were just ignored in previous PGF versions.
Defining a soft mask involves the creation of a so-called PDF-XObject, a self-sufficient, graphical object that is later used to mask (i.e. to add transparency to) other graphical objects, as shown in the example below.
Creating a soft mask takes place at the upper left corner on the page of its definition. Pre-defined soft masks of the
fadings library are created on the first document page. What you see in the intermediate PS output are the underlying graphical objects that are used in this process. They cannot be hidden, but disappear in the final PDF-making step (
ps2pdf -dALLOWPSTRANSPARENCY ...).
Since Fadings are a PDF-only feature, it does not make sense to publish/to release the intermediate PS version of a document containing these. You will have to produce (
ps2pdf -dALLOWPSTRANSPARENCY ...) and ship the PDF instead.
If you really need to send out PS, perhaps because the publisher wants it, convert the PDF back to Postscript, using
pdf2ps. The resulting Postscript is visually indistinguishable from its PDF precursor.
ex.tex with a user-defined soft mask. Typeset with
ps2pdf -dALLOWPSTRANSPARENCY ex.ps
(Note that processing documents relying on transparency features requires Ghostscript-9.52 or later.)
% define soft mask
\tikz\shade [left color=pgftransparent!0, right color=pgftransparent!100] (0,0) rectangle (2,2);
% checkerboard background
\pattern [pattern=checkerboard, pattern color=black!30] (0,0) rectangle (9,4);
% blue rect with transparency gradient
\fill [color=blue, path fading=myFading] (1,1) rectangle (3,3);
% red rect with transparency gradient
\fill [color=red, path fading=myFading] (4,1) rectangle (8,3);
Intermediate Postscript (as shown in
GSview or printed on paper):
Final PDF (after
ps2pdf -dALLOWPSTRANSPARENCY ex.ps):
Postscript, back-converted from PDF (
pdf2ps ex.pdf ex2.ps):