Skip to content
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

Low print quality for texts, maybe fonts not rendered correctly. #6498

Closed
edwardmeng opened this issue Oct 3, 2015 · 31 comments
Closed

Low print quality for texts, maybe fonts not rendered correctly. #6498

edwardmeng opened this issue Oct 3, 2015 · 31 comments
Labels

Comments

@edwardmeng
Copy link

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.

@chr1sb
Copy link

chr1sb commented Oct 8, 2015

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

@timvandermeij
Copy link
Contributor

Possibly related to #5006.

@chr1sb
Copy link

chr1sb commented Oct 12, 2015

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

@timvandermeij
Copy link
Contributor

Interesting find, thanks for looking into this!

@ghost
Copy link

ghost commented Nov 17, 2015

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?

@edwardmeng
Copy link
Author

This issue seems have been fixed in the latest version 1.3.88

@THausherr
Copy link
Contributor

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

@timvandermeij
Copy link
Contributor

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

@alisham70
Copy link

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.

@timvandermeij
Copy link
Contributor

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.

@bytor99999
Copy link

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.

@alisham70
Copy link

Hi, is there any update to resolve this issue?

@bytor99999
Copy link

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.

@alisham70
Copy link

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.

@loueradun
Copy link

Any progress on this?

@timvandermeij
Copy link
Contributor

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.

@AndreasEK
Copy link

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

@alisham70
Copy link

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.

@AndreasEK
Copy link

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)

@alisham70
Copy link

@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).

@paolocaminiti
Copy link

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?

@anita-verma
Copy link

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?

@timvandermeij
Copy link
Contributor

Closing as fixed by #7694.

@alexyuriev
Copy link

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.

@tpanum
Copy link

tpanum commented Jan 18, 2018

Can confirm what @alexyuriev states.

@nyanpasu64
Copy link

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.

@timvandermeij
Copy link
Contributor

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.

@amotl
Copy link

amotl commented Mar 4, 2019

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

@timvandermeij
Copy link
Contributor

timvandermeij commented Mar 4, 2019

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.

@amotl
Copy link

amotl commented Mar 5, 2019

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

@timvandermeij
Copy link
Contributor

No problem! Glad to be able to help out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests