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

Printing #5718

Closed
AdamBes opened this issue Feb 9, 2015 · 21 comments · Fixed by #5857
Closed

Printing #5718

AdamBes opened this issue Feb 9, 2015 · 21 comments · Fixed by #5857

Comments

@AdamBes
Copy link

AdamBes commented Feb 9, 2015

Printing a range of PDF pages seems to result in the last few being cut off. (i.e. printing from 26-31 will print pages 26-28 with a blank page in between).

Padding is miles off on some tested files (9cm along the bottom and 8cm along the right edge)

  • verified and viewable on print preview (seems to have so far only occurred for some microsoft word documents.
    screenshot 2015-02-10 11 38 57

Blank pages are being added after every page (this is visible from print preview) - issues has been consistent on each PDF ive tested except the one with large padding issues above ^
screenshot 2015-02-10 11 40 02

@timvandermeij
Copy link
Contributor

Do you have a PDF file for us to test with?

@AdamBes
Copy link
Author

AdamBes commented Feb 9, 2015

https://www.dropbox.com/s/e2xprzc853lmxlg/example_RTL.pdf?dl=0
After each page it has inserted a blank page on print preview.

@Hengjie
Copy link
Contributor

Hengjie commented Feb 11, 2015

@Rob--W do you have any ideas what causes this?

@Rob--W
Copy link
Member

Rob--W commented Feb 12, 2015

@Hengjie Not immediately, but I have some ideas about how to debug this issue. I don't have the time to debug it at the moment.

@yafp
Copy link

yafp commented Mar 10, 2015

Hi,
i am realizing pretty similar issues with some pdf documents if i am using the PDF Viewer in Mozilla Firefox - which is pdf.js based again right?

So i am not sure if that particular problem is chrome-specific.

@Rob--W
Copy link
Member

Rob--W commented Mar 10, 2015

The original link to the PDF is dead. @AdamBes and @yafp Could you share a link to the PDF file?

@yafp
Copy link

yafp commented Mar 11, 2015

Hi,
i can only provide a pdf file i used to reproduce the issue.
http://kniel.de/download/96141656.02.pdf

The printing results (using always the same printer on the same linux hosts) from within

  • Adobe Acrobat: - is as expected
  • Chrome: almost as expected - but embedded images seem to be shrinked compared to Acrobat
  • Firefox: Footer of each page is cutted off and additional empty page is printed. Fonts mismatch in header, images seem bigger then in Acrobat. Display and printing results in firefox using pdf.js differ heavily.

Hope this helps

I was willing to attach the pdf as mirror to this issue - but github only supports image formats like png, gif and jpg. Should i offer any other mirror for that pdf as i cant quaranty it will be online for unlimited time (might be replaced with an updated version in the future)

Feel free to ask further - i will provide as much information as possible/needed ;)

Greetings

@Rob--W
Copy link
Member

Rob--W commented Mar 11, 2015

In Chrome 41.0.2272.77, the print preview of the PDF looks like this, unless I change the paper size from "Letter" to "A4". Using the A4 letter size, there is a blank page between every page (just like you describe for Firefox):
chromeprint

Chrome seems to offer @page {size: width height;} for more control over the paper size, but it cannot be applied to a single page only, but all pages. Since most of the pages have a fixed size, adding a paged media rule might help with resolving some of the printing issues.

@yafp For comparison, could you take a screenshot of how the PDF looks in your browser/viewer?

@yafp
Copy link

yafp commented Mar 11, 2015

Hi,
i've attached the print preview in chrome as well.
viewerchrome

But please keep in mind - its not about the print preview - its about the print result ;)
And the print result of Firefox is just horrible .. while the one from Acrobat and Chrome seems pretty much ok & as expected.

Regarding the extra pages: In Firefox i get 1 blank page at the end of the document - not after each printed page.

Greetings

@Rob--W
Copy link
Member

Rob--W commented Mar 11, 2015

Which version of Chrome are you using? I don't see the "Fit to page" option in Chromium 41.0.2272.77, not with the Chrome extension and neither with the built-in PDF viewer (PDFium).

If you untick "Fit to page", does Chrome's result look similar to Acrobat's?

@yafp
Copy link

yafp commented Mar 11, 2015

Hi,

i am using Chrome 39.0.2171.95 (64-bit) on Ubuntu 14.04.
If i untick the option "Fit to page" and do print again - the output looks less similar to Acrobat then before ... but actually not bad either ;)
To having the setting ticket was overall a good setting.

May i asked why you are only focusing on Chrome?
Should i open another issue for my mozilla concerns?

@Rob--W
Copy link
Member

Rob--W commented Mar 11, 2015 via email

@yafp
Copy link

yafp commented Mar 11, 2015

Ok - just to have it pointed out once again.
The pdf file i did provide - had small differences between Acrobat and Chrome and big differences between Acrobat and Firefox - at least on my linux machine.

so i doubt this pdf file might be the best document to focus on chrome specific issues.

Lets hope for @AdamBes then to provide his document as well.

@Rob--W
Copy link
Member

Rob--W commented Mar 16, 2015

@yafp
I've taken another look at your PDF, in Firefox. The cut-off happens when the printer is set up to print in the US letter format (instead of A4). When I change the printer setting to print as A4 instead, I get a result that is similar to PDF.js in Chrome, namely a blank page between the real pages.

Changing the units from pt to inches (with an equivalent value, http://www.printernational.org/iso-paper-sizes.php) seems to fix the blank page problem here. I've reported the inconsistency in handling pt/inch at https://code.google.com/p/chromium/issues/detail?id=467579.

@yafp Could you check whether Firefox correctly renders your PDF when the paper size is set to A4?

@yafp
Copy link

yafp commented Mar 17, 2015

@Rob--W:
if i do change from "Letter" to "A4" the printing result is much better. Primary because it seems to use the correct fonts now. The single pages seem cutted at the correct position.

Regarding the additional blank page:
I still have an empty/blank page at the end - so i do get my 2 pages and 1 additional blank page at the end - which is wrong.

@Rob--W
Copy link
Member

Rob--W commented Mar 17, 2015

@yafp The font is probably not related to the letter size (I have seen bad fonts in Firefox's print preview during testing, that's not related to this issue).

The blank page issue only occurs in Chrome, not Firefox, right?

@yafp
Copy link

yafp commented Mar 17, 2015

No - my last comment was totally targeting Firefox (v36 on linux).
So the blank page is affecting Firefox - at least for me.

But your question made me retesting Chrome again - and it works fine for me if it comes to the blank pages

To sum it up: i do have blank pages at the end of the print if i do use Firefox - but not in Chrome.

@Rob--W
Copy link
Member

Rob--W commented Mar 17, 2015

@yafp Ah, I see. I also get a blank page at the end with your PDF (http://kniel.de/download/96141656.02.pdf) in Firefox 36.0 (Linux) with paper size A4 and scale 100%.

In Chrome (using the PDF.js Chrome extension and presumably also in the viewer demo), I get a blank page between every page. I guess that you tested using Chrome's built-in PDF viewer instead of the PDF.js viewer?

@Hengjie
Copy link
Contributor

Hengjie commented Mar 17, 2015

@Rob--W I've reuploaded the original PDF here:

https://dl.dropboxusercontent.com/u/7246095/example_RTL.pdf

@Rob--W
Copy link
Member

Rob--W commented Mar 17, 2015

@Hengjie Thanks. It seems to be the same issue as the PDF reported by yafp. It seems that the issue applies to EVERY A4-sized documents (see also #5718 (comment)). I'll write a patch for PDF.js to address the issue.

@yafp
Copy link

yafp commented Mar 17, 2015

@Rob--W
Yes i always used Chromes inbuild PDF.js - wasn't aware of a viewer. Thanks for the pointer.
Gonna play with that as well.

@Hengjie
thanks for adding your file

Rob--W added a commit to Rob--W/pdf.js that referenced this issue Mar 18, 2015
Chrome and Firefox internally uses integer pixels for paper size, while
PDFs use points. Due to rounding errors, blank pages may appear between
printed pages (in Chrome). In Firefox, the rounding errors don't cause
any observable issues because pages are clipped anyway (and page breaks
are not forced).
This patch fixes the problem by converting points to pixels,
and rounding the dimensions (height = round down, width = round up).

To test the result, open a PDF with A4 size, such as the ones in
mozilla#5718 and show a print preview.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants