Ghostscript 破坏了 TikZ 阴影?

Ghostscript 破坏了 TikZ 阴影?

我在文档中使用了精美的 TikZ 阴影pdflatex,效果很好。但是,如果我使用 ghostscript(或其ps2pdf前端)处理 PDF 文档,阴影就会损坏。处理的目的是为了减小文档的大小,因为文档中有很多图像,我认为这是无关的问题。

以下是详细信息。MWE:

\documentclass[border=1cm]{standalone}

\usepackage{tikz}
\usetikzlibrary{fit}
\usetikzlibrary{through}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shadows}
\usetikzlibrary{shadings}
%% even fancier shadows
\usetikzlibrary{shadows.blur}
%% fade
\usetikzlibrary{fadings}

\begin{document}
\begin{tikzpicture}[align=center,node distance = 1.2em and 1.2em,  
  rounded corners=10, blur shadow={shadow blur steps=50}]
  
  \tikzstyle{block} = [rectangle, fill=blue!10, draw, text width=6em,
  text centered, minimum height=2.1\baselineskip,
  blur shadow={shadow blur steps=50}
  ]

  \node (t) [block] {Test};
\end{tikzpicture}
\end{document}

原始文件之后latexmk -pdf mwe

原始文件

现在,我调用gs

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.7  -dPDFSETTINGS=/printer -dColorImageDownsampleType=/Bicubic -dColorImageResolution=72 -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=72 -dMonoImageResolution=150 -dOptimize=true -q -o small-gs.pdf mwe.pdf

结果是:

与 gs 发生冲突

我也可以调用ps2pdfps2pdf mwe.pdf small-2pdf.pdf,结果是一样的。(难怪,它是的前端gs。)

与 ps2pdf 不兼容

版本:

$ pdflatex --version
pdfTeX 3.14159265-2.6-1.40.21 (TeX Live 2020)
kpathsea version 6.3.2
Copyright 2020 Han The Thanh (pdfTeX) et al.
There is NO warranty.  Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.02

$ gs --version
9.52

已在 MacOS 10.15.6 和 GitLab 上的构建系统(texlive-latestUbuntu 镜像)上验证。我在 Preview.app 中查看 PDF。

我做错了什么?(显然,除了使用预览之外。)

如何保持我的 PDF 文件更广泛的兼容性?

答案1

最近添加了对dvips+的褪色(非均匀透明度)支持,并且仅在其ps2pdfpgfGitHub 存储库。如需测试,请下载https://github.com/pgf-tikz/pgf/archive/master.zip并复制tex文件夹放入工作目录中。另外,还需要 Ghostscript-9.52,并且ps2pdf必须使用选项 运行-dALLOWPSTRANSPARENCY

答案2

较低的 PDF 版本有帮助,ps2pdf13 mwe.pdf test-pdf13.pdf可以按预期渲染阴影。尺寸是另一个问题...

有用

相关内容