Pdf.js: Low print quality for texts, maybe fonts not rendered correctly.

Created on 3 Oct 2015  Â·  31Comments  Â·  Source: mozilla/pdf.js

OS: windows 10
Browser: Firefox 41.0.1
Pdf.js version: 1.1.494
Url: http://mozilla.github.io/pdf.js/web/viewer.html
In the firefox browser, it can be rendered correctly as following
qq 20151004001137
But when it's printed, the words will be misplaced or blurred as following
qq 20151004001342
And then I try to print with the embedded pdf.js in Firefox browser, it can be printed correctly.

I do not know why, but it very important for me.

4-printing

All 31 comments

Seeing the same issue with fonts not rendering correctly when printing, started after firefox version 41 was released.

Possibly related to #5006.

The issue is related to CSS font Loading API being enabled by default in Firefox 41,
changing the about:config preference "layout.css.font-loading-api.enabled" to false fixes the printing issue.

Just now need to determine what to change in PDF JS so that it works without changing about:config preferences

Interesting find, thanks for looking into this!

yes layout.css.font-loading-api.enabled fixes the problem, but if that is the problem then why would it print correctly with the pdf.js that comes with Firefox?

This issue seems have been fixed in the latest version 1.3.88

No it doesn't work, here's the output I get with a HP mfp printer:
20160108_163326

I can confirm that print preview does not work for me too, which the same result as above. Reopening.

Yes! I do get the same problem... When preview the document, it's looks ok with proper font but when printing it is not... The incorrect font same as edwardmeng commented on Oct 4, 2015. Not all print out have incorrect font but sometimes it's happened. But when I download the generated pdf file and open using Foxit Reader, the print out ok.

I am able to reproduce the issue 100% of the time on Arch Linux. I know from other people that use Linux (Ubuntu and other distributions) that they also hit this bug 100% of the time. Interestingly, flipping the layout.css.font-loading-api.enabled preference does solve this for me, so I wonder if this is actually an upstream issue regarding the font loading API? Note that it only happens using Firefox for me: Chrome for instance has no issues.

We have blurry text as the document goes along. The first parts look relatively crisp, but each page it gets progressively worse. We are using Win/Mac/Linux all on Chrome. The UI Web App though is running on Linux EC2 instance.

Hi, is there any update to resolve this issue?

We recently tried the latest version and still had blurriness. And ended up just using the built in Chrome PDF previewer and that worked perfectly for us.

Mark

On Jun 7, 2016, at 12:18 AM, alisham70 [email protected] wrote:

Hi, is there any update to resolve this issue?

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

I'm planning to use Chrome if this issue cannot be resolved in near future because we are going to do User Acceptance Test for printout with my customer soon. I have tested using Chrome previously and it print ok. I prefer using Firefox instead of Chrome.... but seems I have no choice here.

Any progress on this?

It's most likely an upstream issue with the font loading API, or perhaps in combination with the PDF.js code. We need to look into what exactly is causing this.

Can I support in any way? Our customers are reporting the same issue.

In my opinion, this issue is hard to troubleshoot as it seems to happen at random. Sometimes the printout is ok and sometimes it is not.

Well, it was immediatly reproducable for me and other here reported too, that they can reproduce it 100%. (I was using Firefox 47.0.1 on Mac)

@AndreasEK any ideas how to solve it?... My customers also having the same issue... It is not happen if using chrome... (but my customer prefer firefox instead of chrome).

Having this same issue on a customized viewer.
At first I tought the textLayer was been renderer, but that's not the case, the textLayer characters are fine while missing from the erroneous print.
So it must be the canvases in the printContainer... but they are correctly rendered, you can test this quickly with something like this so that them will stay visible:

[ mozPrintCallback_Polyfill.js:31 ]
window.print = function print() {
  outerContainer.remove()
  printContainer.style = "display: block;"
[ viewer.js:1307 ]
afterPrint: function pdfViewSetupAfterPrint() {
  return

The next step seems to be when PDFPageProxy_render in pdf.js gets called with the context from mozPrintCallback argument as defined by the funciton assigned to canvas.mozPrintCallback in pdf_page_view.js . But I could not find any valid documentation about mozPrintCallback internals, so it's not clear to me if the rendering is happen in the viewer and assigned to the print context as a blob or if canvas instructions are executed by the browser print itself...

By curiosity inspecting the 2d context passed to mozPrintCallback it has a font property set to 'sans-serif' which is the default font I'm getting everywhere in erroneous prints.

Has anyone any clue how to investigate this? Is there any documentation about mozPrintCallback?

May the issue be in any of the //#if !(MOZCENTRAL || FIREFOX) related code?

I am also facing the same issue. I am using font 'Times New Roman' in my PDF which is displaying correct in Mozilla but when taking print font is not appearing correctly. Also font style bold and italic are not appearing. Please suggest something for this. When will this issue be fixed?

Closing as fixed by #7694.

Rubbish. It is still not fully functioning, with or without the workaround even in 45.9.0 under Debian 8. Preview looks correct all the time. In Print fonts do not load properly 80% of the time.

Can confirm what @alexyuriev states.

Bug is not fixed. When printing on Kubuntu 18.04 to Brother MFC-J880DW, Firefox does not properly load fonts when printing certain Latex documents.

I think all PDF printouts appear blurry, but only some load the wrong font.

Pull request #9982 is a follow-up for this that allows us to use the font loading API in Firefox, which previously wasn't possible and should fix the wrong fonts when printing.

Dear @timvandermeij and all people of pdf.js and Firefox,

we experienced a problem with a recent Firefox release which feels similar to this issue, so we would like to share our observations here.

Introduction

After following #9982 to [Bug 1473742] (Fonts loaded with CSS font loading API not printable), this tells us that the corresponding issue might have been RESOLVED FIXED in Firefox 63 already, right? We found different issues regarding font loading in pdf.js but we can't tell if we are actually facing the same issue. Nevertheless, we wanted to report our findings.

Observation

We found the PDF document [1] to print with distorted text while displaying fine in Firefox before. However, the document prints flawlessly when sent to the printer from the operating system after downloading it first. This also feels like a font issue of pdf.js to us. We also attached the corresponding output from pdffonts below and link to [2] for reference.

We are running Firefox 65.0.1 on macOS 10.13.3.

Maybe you can figure out what might be going wrong with these PDF documents published by the EPO? Thanks in advance for your efforts.

With kind regards,
Andreas.

[1] https://data.epo.org/publication-server/pdf-document?cc=EP&pn=1508424&ki=A1
[2] https://meta.ip-tools.org/t/problem-when-accessing-pdf-document-of-ep1508424a1/131


Appendix

pdffonts output of EP1508424A1.pdf.

$ http 'https://data.epo.org/publication-server/pdf-document?cc=EP&pn=1508424&ki=A1' > EP1508424A1.pdf

$ pdffonts EP1508424A1.pdf
name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
VCVGEE+ArialMT                       Type 1C           Custom           yes yes yes     48  0
VCVGEE+Arial-BoldMT                  Type 1C           Custom           yes yes yes     47  0
IBLOAD+C39P24Nfz                     Type 1            Custom           yes yes no      52  0
VCVGEE+Symbol                        Type 1C           Builtin          yes yes yes     55  0
VCVGEE+Arial-ItalicMT                Type 1C           Custom           yes yes yes     25  0

I think it may be fixed by the new patch https://bugzilla.mozilla.org/show_bug.cgi?id=1524640, which resolved an issue with font loading when printing from Firefox. You can check this with Firefox Nightly.

Dear @timvandermeij ,

thanks a bunch for your quick answer. We have been able to confirm this works flawlessly with a current Firefox Nightly again, as will probably also do with the widely available _Firefox Beta 66b12_ already. Excellent! More details and direct download links can be found at [1].

Thanks again and keep up the spirit.

With kind regards,
Andreas.

[1] https://meta.ip-tools.org/t/problem-when-accessing-pdf-document-of-ep1508424a1/131/3

No problem! Glad to be able to help out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kaymes picture kaymes  Â·  62Comments

Snuffleupagus picture Snuffleupagus  Â·  28Comments

Rob--W picture Rob--W  Â·  43Comments

doublex picture doublex  Â·  27Comments

oddjobz picture oddjobz  Â·  46Comments