-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect rendering of PDF plot produced by ggplot2 #6981
Comments
I cannot reproduce the issue with the |
I have to fix my previous statement a bit: I cannot reproduce the oval rendering, but I can reproduce the circles not having the right radius. |
Those are not circles, but bullet character filled or stroked (we might have not exact substitution for what was used in ggplot2 -- ZapfDingbats). The PDF has no embedded fonts, that causes result to be different. |
The circles rendering as ovals was most likely fixed by PR #6651. Unfortunately, they are now rendered too small instead. I guess that this is simply an issue with non-embedded ZapfDingbats fonts. |
Ok, using https://mozilla.github.io/pdf.js/web/viewer.html on FF 44.0.2 on OSX (it just updated), I see the same thing as @yurydelendik. Doing the same thing on FF 44.0.1 on Ubuntu 15.10, the same PDF appears to render correctly. |
Also, it might be relevant that the Linux machine I used for viewing is the same machine that produced that PDF. |
@DarwinAwardWinner So the problem is that your Linux machine has fonts installed that were not embedded into the PDF. This causes rendering issues when the PDF is viewed on a machine that does not have these fonts installed, because in that case font substitution will occur, causing the artefacts you see in your images. Not embedding fonts in PDF files is a deprecated practice, so if you have the possibility you should always generate PDF files that have the necessary fonts embedded, such that they can be viewed correctly on any device. There are already multiple open issues for dealing with PDFs with non-embedded fonts, but we can keep this open for further reference. Edit: I don't know anything about R, but you might want to check out https://www.google.nl/#q=ggplot2+embed+fonts for generating PDFs with embedded fonts. Hopefully it helps. |
Duplicate of #4244 |
I've encountered a PDF that renders incorrectly in pdf.js. It is a plot produced by ggplot2 in R and saved to PDF using the
pdf
function in R. I have prepared several files in a Dropbox folder that you should be able to access here: https://www.dropbox.com/sh/8azllvpnwynuf5r/AABPC9winwBhlYN_LQWWDJbwa?lst=First, is
pcoa-original.pdf
, the original unmodified PDF file, andpcoa-rendered-by-osx-preview.png
, which is a screenshot of how it looks in OSX Preview, which renders it correctly. Then there ispcoa-rendered-by-pdfjs-in-firefox.png
, a screenshot of the same PDF file viewed in Firefox 44.0. Then there ispcoa-saved-by-pdfjs.pdf
, which is the result of clicking the "print" button in pdf.js, and then using the OSX print dialog to save a PDF file. Lastly, there ispcoa-saved-by-pdfjs-rendered-in-preview.png
, which is a screenshot of Preview's rendition of that saved PDF file.As shown in the first screenshot, there are circular points and circular crosshairs plotted, both in varying colors and sizes. The second screenshot shows that pdf.js renders the circles as ovals, and shifts their centers downward slightly. The "cross" part of the crosshairs, as well as the chart background, labels, and scales, all seem to be rendered correctly. The third screenshot shows that in the saved PDF output, the circles are still ovals, but in addition the circular portions of the crosshairs are massively enlarged and shifted up and to the right.
The text was updated successfully, but these errors were encountered: