[Tex/LaTex] why does texstudio internal PDF viewer shows streak white lines on image

pdftexstudioviewers

issue also opened at https://github.com/texstudio-org/texstudio/issues/51


When I compile this MWE latex file in texstudio, on windows, using MikTex, then view the result using texstudio internal PDF viewer, it shows white streak lines going over the image. These lines are not in the original image.

Also these lines do not show up when I view the compiled PDF file using external PDF reader such as adobe.

Why is that? The image is also a PDF file. Is it possible to resolve it? It is not a big issue really, since this seems to be just an artifact of texstudio pdf viewer itself, but thought to ask if there is an option to fix this.

Here is MWE

\documentclass{article}
\usepackage{graphicx}
\begin{document}
This is my image, as PDF file, imported using includegraphics

\includegraphics[width=\textwidth]{image}    
\end{document}

I put the file image.pdf is on my web page here

This is how the compiled PDF looks like inside texstudio PDF viewer

Mathematica graphics

This is how the PDF looks like inside adobe PRO pdf reader

Mathematica graphics

Notice the white lines that show up in texstudio. This is pdfinfo on the image file

pdfinfo image.pdf 

Creator:        Wolfram Mathematica 11.2.0.0 for Microsoft Windows (64-bit) (September 10, 2017) Student Edition - Personal Use Only
Producer:       
CreationDate:   Sat Mar  3 16:13:39 2018
ModDate:        Sat Mar  3 16:13:39 2018
Tagged:         no
UserProperties: no
Suspects:       no
Form:           none
JavaScript:     no
Pages:          1
Encrypted:      no
Page size:      470 x 367 pts
Page rot:       0
File size:      99049 bytes
Optimized:      no
PDF version:    1.5

I am using

TeXstudio 2.12.6 (hg 6632:7777b2b8a906)
Using Qt Version 5.9.1, compiled with Qt 5.9.1 R

Windows 7.

Best Answer

This is an issue which was common to several versions of Mathematica, though strangely I can't reproduce it using Mathematica 11 (on Linux, not Windows). It happens when vector graphics are shaded using polygons (as is the case here), but the outlines of the polygons are omitted. To fix the issue, export your image as eps (you can convert to pdf later), by enclosing your ContourPlot command in an Export command:

Export[ "myfile.eps" , Contourplot[ ... ] ] 

Then, open up the eps file in your favourite text editor, and find the macro which is used to fill polygons. This will be near the top of the file, and will probably be something like

/f { fill bind def }

or perhaps

/f fill load def

Change fill to gsave fill grestore stroke and save the file. The new instruction tells the viewer to shade the polygons and draw their outlines. After reloading in your viewer, you should find that the issue is gone.