Hello,
I create a pdf in Texshop (Version 3.52) with pdftex on my Mac (OS X 10.7.5) of a simple 3D pgfplot. I use the option 'shader=interp' and '\addplot3[surf]' as shown in the MWE shown here.
The output pdf file looks ok but when printed via Texshop, Texworks or Preview it misses the entire map, that is to say all the colors in the plot. See below on the left what the pdf looks like in a viewer and how it looks when it is printed out on the right.
I tried to use different printers and updated Texshop but saw no difference. Furthermore, using the 'TeX and DVI' option to compile the pdf or changing the pdf version via '\pdfminorversion' did not help either. I can only solve it when using Acrobat reader (Version 11.0.06) to print the pdf file or removing the option 'shader=interp' in the code. But both options are unsatisfying.
I found that other people have the same problem and reported it on StackExchange - but no solution so far. It seems that this is a bug.
Thanks in advance for help!
Thanks for the report.
While I am sure that this is due to a bug, I doubt that it is a bug in pgfplots.
I do know that interpolated shadings are different than simple stroked paths, and I do know that many free viewers fail(ed) to render them correctly. Actually, I fixed libpoppler on my own some time ago. I would not be surprised if some printer driver or viewer which "talks" to a printer has bugs as well, especially since these shadings are not soo common unless you have scientific papers.
The fact that acrobat reader correctly displays and prints them speaks in favor of pgfplots.
I tested the feature shader=interp on various printers some time ago, without difficulties.
How did you generate the "when printed" image? Is this a "simulation" or is this output of some conversion tool "pdf to image"? Did you get error messages? Is there some diagnostic information?
Kind regards
Christian
Hey Christian,
Thanks for your answer. The "when printed" image above is a simulation, that is to say I photoshopped the image to illustrate how it looks when printed :)
I have tried to print the 3D pgfplot with two different printers at my work, where I often print scientific papers without any problems. The fact that these two printers print my 3D pgfplot correctly when using Acrobat reader might also tell us that it is not a printer driver bug. I also wanted to stress that as soon as I remove the 'shader=interp' option, any viewer prints the plot exactly as it should be.
During compilation I do not see any error messages in the console. If it helps I can post the entire output from the console. Or would it help if I upload the output pdf-file of the 3D pgfplot?
Cheers,
Andi
Ps: By the way, I really enjoy using pgfplots and I am very grateful for your work and commitment.
Hi Andi,
Thanks for the input.
Is there a way to print the file into a file? Perhaps a .ps or .pdf
file? Maybe this gives us some insight into what is going on.
I admit that I have no clue how to address the problem. Even if I try to
reproduce it with my own printer would not give any insight, no matter
if I reproduce the problem or not.
Imho it is some kind of driver problem, although I do not know which
component contributes the driver. Perhaps each viewer has to provide its
own driver which talks with the operating system? Or perhaps your
acrobat is configured to print the pdf as image?
The only thing that I can think of is to print to a file and to see if
that file reveals any problems. Alternatively, you could contact the
support of the printer team or viewing application which fails to print
the document. Another idea is to find some tool (acrobat pro?) which can
analyse the pdf for any kind of problems such that I have something to
"grab" the problem. I have to say that I did this kind of validation
some time ago and found no problems.
Kind regards
Christian
Am 09.09.2015 14:30, schrieb Andi B:
Related
Bugs:
#92Good thing you pointed this out: when I print the pdf to a file (e.g. another pdf) with Preview app I get the same problem. The plot again misses all the colors, just as "simulated" in my first post. I tested this also on other computers with newer OS X version (Yosemite).
This brings me back to wondering if some viewers have problems with the way this pdf was created. In the file info it states as an encoding software 'pdfTeX-1.40.16' which is by the way the latest version since I just updated MacTex. When I print to file the new pdf has the following encoding software: 'Mac OS X 10.7.5 Quartz PDFContext'.
Anyways, I uploaded the output pdf and the log file:
https://dl.dropboxusercontent.com/u/14495068/shading_print_problem.pdf
https://dl.dropboxusercontent.com/u/14495068/shading_print_problem.log
And I also just noticed that when I open the link for the pdf in Firefox, the plot also does not appear correctly - this time it creates a black void instead of a white. However, it looks fine in Safari. The problem becomes more general and confusing than I thought :)
Andi
Hi Andi,
could you also attach the output of "print to pdf file"? This will
reveal the problem; it is the viewer or printer driver which produces
the corrupt output.
The file on dl.drobbox* appears to be intact. Only the pdf.js script is
unable to render the shadings - a pure viewer problem.
Kind regards
Christian
Am 10.09.2015 17:46, schrieb Andi B:
Related
Bugs:
#92Dear Christian,
Sorry for the delayed answer. Please find the print-to-file version attached ('shading_print_problem_output.pdf').
I have now found a problem with the 'shader=interp' pgfplot on 4 different computers - 3 Macs with different OSX and 1 PC with Windows 7. The pdf is either printed wrongly in the case of Preview App (white void) or displayed incorrectly with Firefox (black void) and a version of Adobe Acrobat X 10.1.15 on a PC. The latter looks like in the attached screenshot 'shadingproblem_onPC.jpg'.
Please don't get me wrong, I very much appreciate your assessment but based on what I described above it looks like we are dealing with a corrupted pdf-file instead of a driver problem, don't you think? Is there any other software we can test the output pdf with?
I wanted to add that also in the pgfplots manual (http://pgfplots.sourceforge.net/pgfplots.pdf) my Firefox browser has problems with all the examples that include 'shader=interp' and shows a black void.
And by the way, it actually seems to look like a problem with the colors since the shape of the 3D plot is still there (see screenshot 'shadingproblem_pgfplotsmanual.jpg')
Andi
Hi Andi,
thanks for sending the printed version.
Unfortunately, it contains just a sampled image instead of the shading.
Apparently the producer (Mac OS X 10.7.5 Quartz PDFContext) failed to
sample the document correctly; I got no clue on why it failed. If that
tool doesn't complain about anything, I cannot do anything about it;
even if it is a bug in pgfplots.
I see your point with the "3 different macs and 1 PC". I have also
noticed that pdf.js (what you called "my firefox") shows just a black
void. In addition, your report with Acrobat X really counts as that is
"the" reference. I'll experiment with that one in the future.
I have googled around for "positive" examples of these shadings and
found https://issues.apache.org/jira/browse/PDFBOX-1915 ; it contains a
couple of test documents. LATTICE1.pdf and LATTICE2.pdf are the closest
matches to the shadings generated by pgfplots, and they display almost
correctly in firefox. Pgfplots can also generate such graphics by means
of the following code snippet
\pdfcompresslevel=0
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\usepgfplotslibrary{patchplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[small,view={0}{90}]
\addplot3[surf,shader=interp,%patch type=bilinear,
mesh/color input=explicit]
coordinates {
(0,0,0) [color=blue] (1,0,0) [color=blue]
\end{tikzpicture}
\end{document}
and the resulting pdf can be viewed with firefox (see attached pdf).
I know that you find it hard to believe, but these shadings are
demanding and many free viewers simply cannot render them correctly,
among them
evince
xpdf (I fixed that manually)
pdf.js (what you call "my firefox")
Feel free to experiment with the pdf graphics on
https://issues.apache.org/jira/browse/PDFBOX-1915 . I suppose that your
previewer will produce problems with some of them.
However, I will follow the route with Acrobat X on windows, that is a
good hint. Maybe it allows me to reproduce and the problem. If it turns
out to be in pgfplots, I'll be happy to fix it.
See also the related bug reports for pdf.js on
https://github.com/mozilla/pdf.js/issues/6287 , I don't know if this is
already available of the stable version of pdf.js (and some of its
issues appear to be open).
It seems as if you need to print these shadings using Acrobat.
Hoping that this sorts out eventually,
with Kind regards
Christian
Am 13.09.2015 23:26, schrieb Andi B:
Related
Bugs:
#92Hello Christian,
Some of the examples you found on https://issues.apache.org/jira/browse/PDFBOX-1915 do indeed cause problems with my viewers (including firefox). The pdf you attached has the same problem as before - it shows a white void when printed. I get your point that shadings are generally a difficult thing for some viewers and it is likely not a bug in pgfplots at all.
I will try to find a workaround, for example print my externalized pdfs with shadings to file using Acrobat Pro or simply rasterize them. It is important for me that the plots are compatible with all viewers, therefore I am not completely satisfied with printing them only via Acrobat.
Thanks for having another look at it with regards to the Acrobat X problem and I hope to hear from you soon.
Andi
Good evening Andi,
it is a pity that free viewers cause problems with these shadings.
Perhaps I find some time to repair the viewers (I did that for
libpoppler already such that viewers like xpdf support the shadings). At
least pdf.js should be fairly simple once I find time + motivation.
But as stated: I will verify Acrobat X and I will fix any identified
problem if possible.
Kind regards
Christian
Am 15.09.2015 11:13, schrieb Andi B:
Related
Bugs:
#92Here is an intermediate update.
I loaded my windows which still has Adobe Reader X 10.1.2 and experimented
with your file.
The results are ... weird. Opening your shading_print_problem.pdf directly
with either SumatraPdf or the mentioned Adobe Reader X results in no
problems (screenshot attached).
I generated the following very minimal file (with pdftex)
\pdfcompresslevel=0
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot3[samples=3,surf,shader=interp] {x*y};
\end{axis}
\end{tikzpicture}
\end{document}
and opened it in Adobe Reader, no problems (screenshot attached).
HOWEVER, if I open BOTH, one of them is broken, exactly as you showed it,
also see the attached screenshot.
No matter what I do, the second opened file is broken and the first is
displayed correctly (see another related screenshot).
Both, my minimal example and your file are "Shading Type 4" in PDF. If I
switch my minimal example to "Shading Type 5", I get no visible
difference, but it appears to work even if I open both. "appear to work"
means that if I open yours first and my with the shading type 5 last, mine
is displayed fine.
To this end, I modified the minimal example as follows:
\pdfcompresslevel=0
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot3[samples=3,patch to triangles,surf,shader=interp] {x*y};
\end{axis}
\end{tikzpicture}
\end{document}
What does that tell us? That acrobat correctly displays all involved files
if it opens just the involved file. That it appears to have more support
for shading type 4 (patch to triangles). But where is the bug? I honestly
do not know it. My suggestion is that it mixes the two opened pdfs (perhaps
because some of the internal keys inside of the pdf file are the same).
That would be a bug in acrobat which is unrelated to the pdf format as such.
I downloaded the most recent version of Adobe Reader XI (11.0.08) and reran
the experiment to open both my (original) P.pdf and your file. Both display
fine.
So, there appeared to be a bug in Reader X which has been fixed in XI. The
shadings as such appear to be rendered correctly.
I see no evidence that this is a bug in pgfplots. If I would have seen one,
I would have fixed it (happily and with high priority). But it seems as if
the file is correct according to the pdf standard.
It is a viewer and/or printer issue.
Sorry, but this seems to be a bug that should be filed to the
viewer/printer driver guys. Perhaps they will be happy to accept example
documents generated by pgfplots. Note that pgfplots can generate
type=bilinear)
patch type=bilinear)
type=tensor bezier)
patch type=tensor bezier)
which might be an interesting test case for those guys... maybe you want to
file a bug. If they want to, I will happily generate representative test
examples with pgfplots.
I'll close the issue.
Kind regards
Christian
2015-09-15 20:08 GMT+02:00 "Christian Feuersänger" ludewich@users.sf.net:
Adding the attachments here. Apparently, the mail-reply function silently ignores the attachments.