PDF.js viewer mangles embedded font
I have a number of documents I want to embed in webpages for easy access. These are PDFs generated with pdftex locally under MikTeX. They use Adobe Minion Pro font. They render flawlessly in Adobe Reader, Sumatra, PDFXchange, and in Chrome (with its built-in viewer). They are also fine in APV PDF Viewer (MuPDF library) and PDF to GO (Documents to Go) on Android . . . you get the idea. But in Firefox they render interspersed with random characters. Example pdf and screen captures available (I don't see a way to post them).
In the meantime I've replaced the PDF.js with the Adobe Plug-in which fixes the issue for me. I'm concerned about others who may visit the site with Firefox as the default setting leaves these documents all but unreadable. Must I alter them to use a different font in order to preserve compatibility with pdf.js? Minion is widely distributed and well regarded (and not cheap) it would require significant adjustment to the formatting as well . . . Please advise.
被采纳的解决方案
The latest version of the PDF viewer is available as an extension and does a better job than the 0.6.143 version shipped with Firefox 19 in a lot of cases.
You can find the latest version of the PDF Viewer (pdfjs) extension here:
- PDF Viewer: https://addons.mozilla.org/firefox/addon/pdfjs/
所有回复 (18)
My advice is to change the font you are using.
In addition to being a non-trivial amount of work to do that, this isn't some random font I dug up off the internet. Adobe Minion Pro is distributed with Adobe's own PDF authoring tools for goodness sake and LaTeX output is about as standardized as pdf tools get. Since pdf.js is the only viewer I've found, out of the half-dozen I regularly work with, that has any issues with my documents; I'm fairly confident the problem is pdf.js
Obviously replacing the font may be a possible solution, but it's the one I was trying to avoid by opening this ticket.
选择的解决方案
The latest version of the PDF viewer is available as an extension and does a better job than the 0.6.143 version shipped with Firefox 19 in a lot of cases.
You can find the latest version of the PDF Viewer (pdfjs) extension here:
- PDF Viewer: https://addons.mozilla.org/firefox/addon/pdfjs/
That worked brilliantly . . . thanks for the excellent suggestion. Will this version be pushed out with the next release of Firefox? If so, time should remedy this issue for me as my users update their browsers.
Thanks again cor-el
The current 20.0 beta has an older 0.7.28 version of the PDF Viewer.
The current 21.0a2 Aurora build has the 0.7.236 version and the 22.0a1 Nightly build has a newer 0.7.337 version, so development is still ongoing.
You can see the version number of the built-in PDF Viewer via this URL:
- resource:///chrome/pdfjs/README.mozilla
I’m also experiencing this font rendering problem. My PDF documents are automatically generated with embedded Arial-Bold family type1 fonts inside. PDF document version is v1.4. Firefox v18.x & v19.x & v20.x can’t render the document properly on to the screen and fonts are enlarged to mess. I discovered that if I tweak the html5 that PDF viewer creates by removing <style id="PDFJS_FONT_STYLE_TAG"> tag from the <head> (using e.g. Firebug), the PDF renders perfect. User just needs to Zoom Out/in once to the redraw the kick in. So, Firefox fix is needed here concerning the embedded fonts. The Fix needs to be inside the normal Firefox maintenance service cycle (automatic update)
Firefox 21 is due to be released later this morning (Tues, May 14). The latest version of PDF.JS should be in Firefox 21, from what I have read.
The current version on AMO is 0.8.1 and Firefox 21 comes with 0.7.236 (Nightly has 0.8.47)
- PDF Viewer: https://addons.mozilla.org/firefox/addon/pdfjs/
FireFox v21. beta did not resolve the Font problem I'm having here...
Did you try the PDF Viewer version from the Mozilla Add-ons website?
Yes I did aswell. "PDF Viewer 0.8.1" does not have any efect. Fonts (embeeed Arial-BoldMT/Type1/Encoding custom) are still messd up.
The Type1 Embedded font problem remains even with Firefox v21.x on Windows platform. With given PDF link below, the browser refuses to render the document properly by giving the user “This PDF document might not be displayed correctly”.
http://w1.if.fi/web/fi/corporate.nsf/0/628CF21A2A4509C4C1257B720028100B/$file/vaha9643998344652.pdf
Our issue is similar. We have spacing issues in the new Firefox v21 PDF.JS which causes our columns with numerical data in them to be misaligned. Switching back to the adobe acrobat plugin fixes the issue, but this is an unacceptable method to make customers do on their own computers..
You can try to test if this already has been fixed.
Latest development version of the PDF Viewer (pdfjs) as a Firefox extension:
Yes, I tried v22 beta and it is fixed. Any word if this version of PDF.js can be released as a v21 patch?
No. You can only get a newer version of the PDF Viewer by either installing the one from the Add-ons website or the latest development version via the link I posted above.
You can find the latest version of the PDF Viewer (pdfjs) extension here:
- PDF Viewer: https://addons.mozilla.org/firefox/addon/pdfjs/
Latest development version of the PDF Viewer (pdfjs) as a Firefox extension:
Nope, PDFViewe 0.8.213 did not resolve my PDF issue that is linked here.
I'm still having a problem with PDF files we generate on our website. We use special custom fonts that are embedded in the document. The generated PDF displays fine in all other viewers except for the Firefox internal PDF.js. In Firefox, the two characters 'g' and 'q' are displayed as spaces and the 'j' appears truncated. All other characters seem to work fine.
Here's a link to the PDF file: https://docs.google.com/file/d/0B83VcttTq86XRmFRQmNrb3JjN00/edit?usp=sharing (download the file and drag-drop into Firefox to see the problem)