# pgf's and pstricks's opacity is not working

I've recently upgraded (on Ubuntu 18.04 LTS) TexLive 2016 to 2017. The problem that came up is that the opacity of tikz (pgf) and of pstricks pictures is not working in .ps and .pdf files after rendering (Latex to dvi to ps to pdf).

I've tried in Texstudio, Texmaker, and Kile and the problem occurred with all three editors. I've tried evince and okular and the problem occurred in both viewers. On the other hand in Qtikz and in Texstudio's preview, opacity is working fine for tikz.

I didn't had this problem with all previous TexLive versions.

Here is a minimal example with one tikz and one pstricks image:

\documentclass[10pt]{article}
\usepackage[english,greek]{babel}
\usepackage[iso-8859-7]{inputenc}
\usepackage{graphicx, color}
\usepackage{pgf,tikz}

\begin{document}

\begin{tikzpicture}[line cap=round,line join=round,x=0.5cm,y=0.5cm]
\clip(-3.6008835336224467,-3.8322994902133702) rectangle     (3.6645946388488806,2.9075908995685467);
\draw [line width=1.2pt,color=gray,fill=gray,fill opacity=0.25] (0.,0.) circle (0.75cm);
\fill[line width=1.6pt,color=blue,fill=blue,fill opacity=0.25] (0.,1.) -- (0.,-1.) -- (2.,-1.) -- (2.,1.) -- cycle;
\draw [line width=1.6pt,color=blue] (0.,1.)-- (0.,-1.);
\draw [line width=1.6pt,color=blue] (0.,-1.)-- (2.,-1.);
\draw [line width=1.6pt,color=blue] (2.,-1.)-- (2.,1.);
\draw [line width=1.6pt,color=blue] (2.,1.)-- (0.,1.);
\end{tikzpicture}

\bigskip

\psset{xunit=0.5cm,yunit=0.5cm,algebraic=true,dimen=middle,dotstyle=o,dotsize=5pt 0,linewidth=0.8pt,arrowsize=3pt 2,arrowinset=0.25}
\begin{pspicture*}(-3.6008835336224467,-3.8322994902133702)(3.6645946388488806,2.9075908995685467)
\pscircle[linewidth=1.2pt,linecolor=gray,fillcolor=gray,fillstyle=solid,opacity=0.25](0.,0.){0.75}
\pspolygon[linewidth=1.6pt,linecolor=blue,fillcolor=blue,fillstyle=solid,opacity=0.25](0.,1.)(0.,-1.)(2.,-1.)(2.,1.)
\psline[linewidth=1.6pt,linecolor=blue](0.,1.)(0.,-1.)
\psline[linewidth=1.6pt,linecolor=blue](0.,-1.)(2.,-1.)
\psline[linewidth=1.6pt,linecolor=blue](2.,-1.)(2.,1.)
\psline[linewidth=1.6pt,linecolor=blue](2.,1.)(0.,1.)
\end{pspicture*}

\end{document}


The result (in both) should be

Any ideas on how to handle this issue?

P.S. Because I have tikz and pstricks in the same document, pfdlatex isn't appropriate to compile.

Due to recently discovered Ghostscript vulnerabilities, a number of operations during format conversion, including transparency related operations, have been disabled for default usage, beginning with GS version 9.24.

They can still be accessed in unsafe operation mode of Ghostscript, which must be explicitly enabled by the user.

Enable unsafe mode with the -dNOSAFER option:

ps2pdf -dNOSAFER myfile.ps myfile.pdf


Of course, this may not be done for PS files of untrusted origin.

• Interesting: does that mean transparency in PostScript is 'dead' (at least for secure ones). – Joseph Wright Oct 4 '18 at 11:36
• @joseph Don't know. The related reports and statements are a long and difficult read. I hope these changes are temporary and will be replaced by fixing their origins. – AlexG Oct 4 '18 at 11:40
• @AlexG thanks! I changed on Texstudio and on Texmaker Ps2Pdf command : ps2pdf -dNOSAFER %.ps %.pdf and tikz and pstricks works fine. Although I can't make it work in Kile. – Grigorios Kostakos Oct 4 '18 at 12:16
• @GrigoriosKostakos Glad to hear this. As for Kile, I don't know how to adjust. I always run the tools (latex, dvips, ps2pdf) on the command line. – AlexG Oct 4 '18 at 12:20
• This answer saved my life. I encountered this issue after upgrading GS. – WDC Nov 9 '18 at 18:36

I'm using Kile. In Kile I use the pdflatex command with the -shell-escape option. For working with opacity I have found this solution. Use the auto-pdf package with this option: \usepackage[pspdf={-dDELAYSAFER}]{auto-pst-pdf}

• Welcome to TeX.Stackexchange! – user36296 Oct 16 '18 at 9:37