# TikZ shadings and printing incompatibility

I would like to use some effects provided by the shadings library of tikz. More specifically, I am trying to use the ball and radial shadings (tikz 2.10 manual, p. 412-).

The resulting pdf looks ok on screen, but causes problems when printing (tried with two different printers). Using the ball shading causes the printer to stall, showing just "processing.." indefinitely (well, at least for several minutes, for a very simple test figure). The radial shading makes the shaded node to print out as completely black. The printers stall also when trying to print the pages of the manual that contain examples of these shadings.

The manual does warn about compatibility issues with transparency and fadings, but not directly about issues with shadings. Apparently similar issues nevertheless apply to shadings also.

Question:

a) Is there a way to make the shadings library to produce printer-friendly output? If not, then

b) Are there safer (but still "simple") alternatives to produce similar effects within tikz?

I have tried to play around with ps2pdf and ps2pdf13, but the resulting pdf behaves strangely even on screen (in evince): it looks soft (rasterized?) at certain zoom levels, zooming around is slow, and so on.

-
I would say this is an issue of your printer driver. TikZ generates pdfs according to the pdf standard - and printer drivers should be able to handle them. As developer of pgfplots, I experimented a lot with shadings and printed some of them. I could print even very advanced shadings. In fact, the printer produced better results than many free viewers. Perhaps you can update the printer driver or use a different one. –  Christian Feuersänger Dec 15 '12 at 17:41
Thanks. For those who just need to print shaded figures by themselves, it is probably useful to know that updating the printer drivers has a good chance in fixing the problem. I got also the impression that technically, TikZ does the shadings completely correctly, but that the incompatibility is about backwards incompatibility with older printers / printer drivers. But of course, this doesn't help when one is preparing a publicly distributed pdf that others might want to print. –  Jeff Sebastian Dec 19 '12 at 13:44

The shading is troublesome in all regards. It still does the rendering in the viewer, hence the shading is computed at "show-time". :)
See for instance the file: pgflibraryshadings.code.tex.

Generally when dealing with shadings, transparency, fadings, etc. you should convert it to an image to be able to print it.

Unless of course, the printer-driver supports the rendering features and has enough computational power/memory. This is rarely the case, which you also experience.

The best thing would be to use the external library or create the image in a single TeX-file and use: convert -trim <in.pdf> <out.png>. Then you can include that in your document by a simple \includegraphics and the problem is gone.

I usually supply my PDF's in two versions:

1. On-screen with full capabilities
2. Easy printing - with all figures converted to PNG for safety.

So the answer is yes, there exist ways to go around, but you do need to convert to explicit colors.

-
Thanks! One problem with this approach is that if (when) there is text inside the shaded node, then the text will suffer from the rasterization and become blurry. I guess that the ideal solution would be to have the shaded background rasterized and then add the text on top of it, maybe via a separate node with no filling. A tool for automating this would be nice indeed.. –  Jeff Sebastian Dec 19 '12 at 10:34
In the preceding comment, I assumed implicitly that rasterization would be done on a node-by-node basis, which of course is not what the external library does, at least by default. Rasterizing just the backgrounds of individual nodes probably needs to be done somehow using tikz's capability to use raster images for node filling, I guess. –  Jeff Sebastian Dec 19 '12 at 10:42
yes, that is not too trivially done at the moment. However, for printouts if you use a resolution of the images of say 400 dpi the rasterization will be so limited that you should not see the difference on paper. You can simply keep increasing the dpi until satisfied! :) –  zeroth Dec 19 '12 at 12:52