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

Print is fuzzy/blurry #2750

Open
BadFriend opened this Issue Feb 20, 2013 · 25 comments

Comments

Projects
None yet
@BadFriend

BadFriend commented Feb 20, 2013

if i print a pdf with FF19 and the new pdf function the print is blurry.

if i print with acrobat the font is clear.

left= acrobat
right = ff pdf

have you an idea?

https://plus.google.com/105533044232180103026/posts/dYL855pBkSM

@gigaherz

This comment has been minimized.

Show comment
Hide comment
@gigaherz

gigaherz Feb 20, 2013

Contributor

I'd guess it's because the pdf.js output is a canvas (one canvas per page, to be exact), which probably doesn't match 100% the printer resolution.

Contributor

gigaherz commented Feb 20, 2013

I'd guess it's because the pdf.js output is a canvas (one canvas per page, to be exact), which probably doesn't match 100% the printer resolution.

@musiphil

This comment has been minimized.

Show comment
Hide comment
@musiphil

musiphil Feb 21, 2013

This happens to me, too.

DSCF8966

  • top = Firefox builtin PDF.js
  • bottom = Adobe Acrobat

The print quality is simply unacceptable.
In addition, the builtin PDF.js generates a black border on the right and bottom sides, just as if it were from photocopying a smaller size sheet.

musiphil commented Feb 21, 2013

This happens to me, too.

DSCF8966

  • top = Firefox builtin PDF.js
  • bottom = Adobe Acrobat

The print quality is simply unacceptable.
In addition, the builtin PDF.js generates a black border on the right and bottom sides, just as if it were from photocopying a smaller size sheet.

@BadFriend

This comment has been minimized.

Show comment
Hide comment
@BadFriend

BadFriend Feb 21, 2013

Any solution? i'm in a hotline and i have 200 users with this problem.

BadFriend commented Feb 21, 2013

Any solution? i'm in a hotline and i have 200 users with this problem.

@yurydelendik

This comment has been minimized.

Show comment
Hide comment
@yurydelendik

yurydelendik Feb 21, 2013

Contributor

@BadFriend, @musiphil, what operating system you or your users use?

Contributor

yurydelendik commented Feb 21, 2013

@BadFriend, @musiphil, what operating system you or your users use?

@tombei

This comment has been minimized.

Show comment
Hide comment
@tombei

tombei Feb 21, 2013

Same issue here on FFox 19 on WinXP to PostScript printer. The fine horizontal lines are dithered, while the vertical lines are fine. Headers and footers are fine as well.

tombei commented Feb 21, 2013

Same issue here on FFox 19 on WinXP to PostScript printer. The fine horizontal lines are dithered, while the vertical lines are fine. Headers and footers are fine as well.

@musiphil

This comment has been minimized.

Show comment
Hide comment
@musiphil

musiphil Feb 21, 2013

I'm running Firefox 19.0 on Windows 7, and I printed those documents to a HP Color LaserJet CP4525 printer with PCL6.

musiphil commented Feb 21, 2013

I'm running Firefox 19.0 on Windows 7, and I printed those documents to a HP Color LaserJet CP4525 printer with PCL6.

@BadFriend

This comment has been minimized.

Show comment
Hide comment
@BadFriend

BadFriend Feb 22, 2013

FF19 + Win7 64bit + OKI561 via PCL6 on WSD Port or Adobe PDF (Adobe Acrobat 9.2.0)

IMG_20130222_074757

left: Chrome Plugin
middle: Adobe Reader
right: Firefox pdf.js

Download PDF -> http://www.file-upload.net/download-7241349/offers-36.pdf.html

BadFriend commented Feb 22, 2013

FF19 + Win7 64bit + OKI561 via PCL6 on WSD Port or Adobe PDF (Adobe Acrobat 9.2.0)

IMG_20130222_074757

left: Chrome Plugin
middle: Adobe Reader
right: Firefox pdf.js

Download PDF -> http://www.file-upload.net/download-7241349/offers-36.pdf.html

@jviereck

This comment has been minimized.

Show comment
Hide comment
@jviereck

jviereck Feb 24, 2013

Contributor

See also #2771. Quoting @brendandahl:

The low quality is being tracked in https://bugzilla.mozilla.org/show_bug.cgi?id=811002 .

Contributor

jviereck commented Feb 24, 2013

See also #2771. Quoting @brendandahl:

The low quality is being tracked in https://bugzilla.mozilla.org/show_bug.cgi?id=811002 .

@timvandermeij

This comment has been minimized.

Show comment
Hide comment
@timvandermeij

timvandermeij Nov 3, 2013

Contributor

The upstream bug has been fixed. Is this still an issue with the latest versions of Firefox and PDF.js?

Contributor

timvandermeij commented Nov 3, 2013

The upstream bug has been fixed. Is this still an issue with the latest versions of Firefox and PDF.js?

@jviereck

This comment has been minimized.

Show comment
Hide comment
@jviereck

jviereck Nov 3, 2013

Contributor

The upstream bug has been fixed. Is this still an issue with the latest versions of Firefox and PDF.js?

I think it was only fixed for Windows. There is a new bug filled for OSX (bug 932313) but I am not convinced it is valid (see my comment at https://bugzilla.mozilla.org/show_bug.cgi?id=932313#c2).

Until the issue is not fixed on Linux, I vote for keeping this bug open.

Contributor

jviereck commented Nov 3, 2013

The upstream bug has been fixed. Is this still an issue with the latest versions of Firefox and PDF.js?

I think it was only fixed for Windows. There is a new bug filled for OSX (bug 932313) but I am not convinced it is valid (see my comment at https://bugzilla.mozilla.org/show_bug.cgi?id=932313#c2).

Until the issue is not fixed on Linux, I vote for keeping this bug open.

@jonny64

This comment has been minimized.

Show comment
Hide comment
@jonny64

jonny64 Feb 16, 2015

Is it fixed?
This demo page prints ok from firefox
http://mozilla.github.io/pdf.js/web/viewer.html
https://dl.dropboxusercontent.com/u/1383480/work/printing/2015-02-16%2011.29.52.jpg

from Chrome and Chromium print result is SO blurry, I can't find words to describe it
https://dl.dropboxusercontent.com/u/1383480/work/printing/2015-02-16%2011.29.58.jpg
I tried to set dpi for printer and PRINT_SCALE RATIO to 1, 3, 4, 8 - no effect
I tried latest version from github (8614c17) - same
(enviroment: Chrome, Chromium, windows 7)

Am I missing something?
Could you please review this and possibly suggest quick workaround?

jonny64 commented Feb 16, 2015

Is it fixed?
This demo page prints ok from firefox
http://mozilla.github.io/pdf.js/web/viewer.html
https://dl.dropboxusercontent.com/u/1383480/work/printing/2015-02-16%2011.29.52.jpg

from Chrome and Chromium print result is SO blurry, I can't find words to describe it
https://dl.dropboxusercontent.com/u/1383480/work/printing/2015-02-16%2011.29.58.jpg
I tried to set dpi for printer and PRINT_SCALE RATIO to 1, 3, 4, 8 - no effect
I tried latest version from github (8614c17) - same
(enviroment: Chrome, Chromium, windows 7)

Am I missing something?
Could you please review this and possibly suggest quick workaround?

@jviereck

This comment has been minimized.

Show comment
Hide comment
@jviereck

jviereck Feb 16, 2015

Contributor

@jonny64 thanks for reporting this! Unfortinate, I guess there is not much that can be done for Chrome/Chromium here. The better print quality in Firefox results by using a special API for printing that is available in Firefox but not in Chrome. Back in the days I proposed the API as a standard but there was not much interest and therefore it is still only available in Firefox.

Contributor

jviereck commented Feb 16, 2015

@jonny64 thanks for reporting this! Unfortinate, I guess there is not much that can be done for Chrome/Chromium here. The better print quality in Firefox results by using a special API for printing that is available in Firefox but not in Chrome. Back in the days I proposed the API as a standard but there was not much interest and therefore it is still only available in Firefox.

@jonny64

This comment has been minimized.

Show comment
Hide comment
@jonny64

jonny64 Feb 16, 2015

:) @jviereck, well, ok, I should live with it
I tried Chrome internal viewer
It prints ok, but it's 'Save' brokes kiosk mode
(we need to print with preview from Chrome in kiosk fullscreen mode)

Fortunatly, I have some backgound with C some time ago
https://pdfium.googlesource.com/pdfium.git
Is it correct source for Chrome internal viewer?
Is it better to hide 'Save' from Chrome settings or when --kiosk command line is set?
Do you have any high level ideas where and how can I implement it?

jonny64 commented Feb 16, 2015

:) @jviereck, well, ok, I should live with it
I tried Chrome internal viewer
It prints ok, but it's 'Save' brokes kiosk mode
(we need to print with preview from Chrome in kiosk fullscreen mode)

Fortunatly, I have some backgound with C some time ago
https://pdfium.googlesource.com/pdfium.git
Is it correct source for Chrome internal viewer?
Is it better to hide 'Save' from Chrome settings or when --kiosk command line is set?
Do you have any high level ideas where and how can I implement it?

@dahjelle

This comment has been minimized.

Show comment
Hide comment
@dahjelle

dahjelle May 8, 2015

This is still a bug on OS X and the latest Firefox Dev Edition, as far as I can tell, at least in some circumstances.

How to reproduce without a printer:

  • Click "Print" in the PDF.js viewer.
  • Click the "PDF" button.
  • Choose "Save as PostScript…" (not "Save as PDF…")
  • Open the saved .ps file in Preview.app.

Text is not selectable and, zooming in, the text is quite pixelated. Text looks great if you chose "Save as PDF…"

dahjelle commented May 8, 2015

This is still a bug on OS X and the latest Firefox Dev Edition, as far as I can tell, at least in some circumstances.

How to reproduce without a printer:

  • Click "Print" in the PDF.js viewer.
  • Click the "PDF" button.
  • Choose "Save as PostScript…" (not "Save as PDF…")
  • Open the saved .ps file in Preview.app.

Text is not selectable and, zooming in, the text is quite pixelated. Text looks great if you chose "Save as PDF…"

@a0preetham

This comment has been minimized.

Show comment
Hide comment
@a0preetham

a0preetham Apr 11, 2016

Contributor

I tried increasing the default resolution in
web/app.js::beforePrint
<< var pageSize = this.pdfViewer.getPageView(0).pdfPage.getViewport(1);

var pageSize = this.pdfViewer.getPageView(0).pdfPage.getViewport(2);

and web/pdf_page_view.js::beforePrint
<< var viewport = pdfPage.getViewport(1);

var viewport = pdfPage.getViewport(2);

Printing is slower but quality has improved

Contributor

a0preetham commented Apr 11, 2016

I tried increasing the default resolution in
web/app.js::beforePrint
<< var pageSize = this.pdfViewer.getPageView(0).pdfPage.getViewport(1);

var pageSize = this.pdfViewer.getPageView(0).pdfPage.getViewport(2);

and web/pdf_page_view.js::beforePrint
<< var viewport = pdfPage.getViewport(1);

var viewport = pdfPage.getViewport(2);

Printing is slower but quality has improved

@yurydelendik

This comment has been minimized.

Show comment
Hide comment
@yurydelendik

yurydelendik Oct 6, 2016

Contributor

Some improvements after #7677

Contributor

yurydelendik commented Oct 6, 2016

Some improvements after #7677

@j30392

This comment has been minimized.

Show comment
Hide comment
@j30392

j30392 Feb 22, 2017

Have there been any updates to this issue in the past 4 months? This is still noticeable on the latest version of pdf.js. I recently rolled out a deployment using pdf.js and now have documents printing with a fuzzy letters that weren't a problem with Chrome's native PDF reader.

You can reproduce this issue by printing from Mozilla's own demo page. I know it isn't a driver issue because it happens when you print to a PDF as well.

It looks like some people using pdf.js in production have had to bypass pdf.js entirely to work around this issue (example).

j30392 commented Feb 22, 2017

Have there been any updates to this issue in the past 4 months? This is still noticeable on the latest version of pdf.js. I recently rolled out a deployment using pdf.js and now have documents printing with a fuzzy letters that weren't a problem with Chrome's native PDF reader.

You can reproduce this issue by printing from Mozilla's own demo page. I know it isn't a driver issue because it happens when you print to a PDF as well.

It looks like some people using pdf.js in production have had to bypass pdf.js entirely to work around this issue (example).

@timvandermeij

This comment has been minimized.

Show comment
Hide comment
@timvandermeij

timvandermeij Feb 23, 2017

Contributor

Currently, higher quality printing is not possible without greatly increasing memory usage, which most browsers won't take well. The canvas back-end cannot provide such functionality. There is a project open (https://github.com/mozilla/pdf.js/projects) to research using the prototype SVG back-end for high quality printing.

Contributor

timvandermeij commented Feb 23, 2017

Currently, higher quality printing is not possible without greatly increasing memory usage, which most browsers won't take well. The canvas back-end cannot provide such functionality. There is a project open (https://github.com/mozilla/pdf.js/projects) to research using the prototype SVG back-end for high quality printing.

@stephenross

This comment has been minimized.

Show comment
Hide comment
@stephenross

stephenross Mar 14, 2017

I have found the PDF.js has had acceptable print quality and fuzzy print quality depending on the version of Firefox installed so would like to take a look at what has changed between the versions I was able to print from. I have https://imgur.com/7Beh7MO, which is output from a direct print from left to right of Firefox 52, 47.0.2, and 42, with the first two at least being fresh updates. As shown, something changed in PDF.js between FF 47.0.2 and FF 52 releases that seems to have crapped up the quality, so if anyone has info on what bookmarks to look at to start with for those versions of Firefox, I wouldn't mind taking a look to start.

stephenross commented Mar 14, 2017

I have found the PDF.js has had acceptable print quality and fuzzy print quality depending on the version of Firefox installed so would like to take a look at what has changed between the versions I was able to print from. I have https://imgur.com/7Beh7MO, which is output from a direct print from left to right of Firefox 52, 47.0.2, and 42, with the first two at least being fresh updates. As shown, something changed in PDF.js between FF 47.0.2 and FF 52 releases that seems to have crapped up the quality, so if anyone has info on what bookmarks to look at to start with for those versions of Firefox, I wouldn't mind taking a look to start.

@stephenross

This comment has been minimized.

Show comment
Hide comment
@stephenross

stephenross Mar 14, 2017

Looking at the Firefox repository versions of PDF.js, I see that 47.0.2 was version 1.4.121, which corresponds to commit 51f6aba (might be the commit after, which is be1e12d) and that Firefox 52 shipped with PDF.js 1.6.315, which is roughly commit c23f124. I am currently looking into diffing these commits, but the difference between them is probably 400 commits and any information on where printing lies would be very helpful.

stephenross commented Mar 14, 2017

Looking at the Firefox repository versions of PDF.js, I see that 47.0.2 was version 1.4.121, which corresponds to commit 51f6aba (might be the commit after, which is be1e12d) and that Firefox 52 shipped with PDF.js 1.6.315, which is roughly commit c23f124. I am currently looking into diffing these commits, but the difference between them is probably 400 commits and any information on where printing lies would be very helpful.

@Snuffleupagus

This comment has been minimized.

Show comment
Hide comment
@Snuffleupagus

Snuffleupagus Mar 14, 2017

Contributor

As shown, something changed in PDF.js between FF 47.0.2 and FF 52 releases that seems to have crapped up the quality,

While it's certainly possible that a change in PDF.js is responsible, I wouldn't (at least initially) entirely discount the possibility that the issue could be related to e.g. graphics/printing code in other parts of Firefox.
It may be helpful, and perhaps even quicker, to use http://mozilla.github.io/mozregression/ to try and find a regression range.

Contributor

Snuffleupagus commented Mar 14, 2017

As shown, something changed in PDF.js between FF 47.0.2 and FF 52 releases that seems to have crapped up the quality,

While it's certainly possible that a change in PDF.js is responsible, I wouldn't (at least initially) entirely discount the possibility that the issue could be related to e.g. graphics/printing code in other parts of Firefox.
It may be helpful, and perhaps even quicker, to use http://mozilla.github.io/mozregression/ to try and find a regression range.

@stephenross

This comment has been minimized.

Show comment
Hide comment
@stephenross

stephenross Mar 14, 2017

stephenross commented Mar 14, 2017

@timvandermeij

This comment has been minimized.

Show comment
Hide comment
@timvandermeij

timvandermeij Mar 14, 2017

Contributor

Previously, we used the Mozilla-specific mozPrintCallback wherever we could if it was supported, i.e., in add-on and non-add-on versions in the Firefox browser, as it presumably allowed us to print with less memory consumption and higher quality. However, we tried to reduce the usage of that because it's Firefox-specific and sometimes buggy, so now we only use it in the Firefox add-on (https://github.com/mozilla/pdf.js/blob/master/web/firefox_print_service.js).

In general, we now render the canvases and print them using the regular browser-defined printing logic, so I think the issue may either be in changed canvas scaling/font rendering code or a browser bug.

Refer to c09f634 for the majority of that change. You might want to check if there is a difference in printing quality from Firefox with and without the add-on.

Contributor

timvandermeij commented Mar 14, 2017

Previously, we used the Mozilla-specific mozPrintCallback wherever we could if it was supported, i.e., in add-on and non-add-on versions in the Firefox browser, as it presumably allowed us to print with less memory consumption and higher quality. However, we tried to reduce the usage of that because it's Firefox-specific and sometimes buggy, so now we only use it in the Firefox add-on (https://github.com/mozilla/pdf.js/blob/master/web/firefox_print_service.js).

In general, we now render the canvases and print them using the regular browser-defined printing logic, so I think the issue may either be in changed canvas scaling/font rendering code or a browser bug.

Refer to c09f634 for the majority of that change. You might want to check if there is a difference in printing quality from Firefox with and without the add-on.

@mpryvkin

This comment has been minimized.

Show comment
Hide comment
@mpryvkin

mpryvkin Mar 4, 2018

Since c09f634 there is now renderPage function in web/viewer.js and print resolution is hard-coded in there as 150 DPI.

function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) {
  var scratchCanvas = activeService.scratchCanvas;
  var PRINT_RESOLUTION = 150;
  var PRINT_UNITS = PRINT_RESOLUTION / 72.0;

To change print resolution to 300 DPI, simply change the line below.

var PRINT_RESOLUTION = 300;

According to the release tags, all PDF.js versions from 1.7.x to 1.10.x should have that ability now. I am surprised this is not documented anywhere.

Ideally there should be ability to change print resolution from query parameters instead of modifying web/viewer.js.

See How to increase print quality of PDF file with PDF.js viewer for more details.

mpryvkin commented Mar 4, 2018

Since c09f634 there is now renderPage function in web/viewer.js and print resolution is hard-coded in there as 150 DPI.

function renderPage(activeServiceOnEntry, pdfDocument, pageNumber, size) {
  var scratchCanvas = activeService.scratchCanvas;
  var PRINT_RESOLUTION = 150;
  var PRINT_UNITS = PRINT_RESOLUTION / 72.0;

To change print resolution to 300 DPI, simply change the line below.

var PRINT_RESOLUTION = 300;

According to the release tags, all PDF.js versions from 1.7.x to 1.10.x should have that ability now. I am surprised this is not documented anywhere.

Ideally there should be ability to change print resolution from query parameters instead of modifying web/viewer.js.

See How to increase print quality of PDF file with PDF.js viewer for more details.

@raztus

This comment has been minimized.

Show comment
Hide comment
@raztus

raztus Mar 5, 2018

If @mpryvkin's fix is legitimate, this should definitely be exposed as an option in about:config.

raztus commented Mar 5, 2018

If @mpryvkin's fix is legitimate, this should definitely be exposed as an option in about:config.

This was referenced Apr 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment