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

Bug 1302069 - Printing canvases at PDF document size. #7677

Merged
merged 1 commit into from
Oct 6, 2016

Conversation

yurydelendik
Copy link
Contributor

@yurydelendik yurydelendik commented Sep 27, 2016

Trying to make printing code sane -- it attempts to print canvases with sizes that are specified in the PDF document. Problem only appear when automatic/non-100% scale is selected in the browser or paper is smaller than PDF page needs. Pros is scale of the print can be now controlled by the user (https://bugzilla.mozilla.org/show_bug.cgi?id=1302069).

@timvandermeij
Copy link
Contributor

timvandermeij commented Sep 28, 2016

Nice work! It turns out that when I printed to PDF before, the scale was set to 200% by Firefox (I'm not sure if that's a default or it's somehow set that way, but I didn't set that manually). Sorry for the noise. If I set that to 100% as it should be, it prints just fine. More testing is necessary, but so far this looks good.

@timvandermeij
Copy link
Contributor

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux)


Received

Command cmd_preview from @timvandermeij received. Current queue size: 0

Live output at: http://107.21.233.14:8877/d0bd116a1ccad76/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux)


Success

Full output at http://107.21.233.14:8877/d0bd116a1ccad76/output.txt

Total script time: 1.04 mins

Published

@yurydelendik
Copy link
Contributor Author

/botio-windows preview

@pdfjsbot
Copy link

pdfjsbot commented Oct 6, 2016

From: Bot.io (Windows)


Received

Command cmd_preview from @yurydelendik received. Current queue size: 0

Live output at: http://107.22.172.223:8877/acdc6d404bb2df2/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Oct 6, 2016

From: Bot.io (Windows)


Success

Full output at http://107.22.172.223:8877/acdc6d404bb2df2/output.txt

Total script time: 1.80 mins

Published

@yurydelendik
Copy link
Contributor Author

yurydelendik commented Oct 6, 2016

Testing on my local computers (Mac and Win) did not discover any regressions (on different browsers). @timvandermeij confirms it work fine on Linux as well (via IRC). We are good to merge.

@yurydelendik yurydelendik changed the title Attempt to print canvases at PDF document size. Bug 1302069 - Prints canvases at PDF document size. Oct 6, 2016
@yurydelendik yurydelendik changed the title Bug 1302069 - Prints canvases at PDF document size. Bug 1302069 - Printing canvases at PDF document size. Oct 6, 2016
@yurydelendik yurydelendik merged commit e48f388 into mozilla:master Oct 6, 2016
@timvandermeij
Copy link
Contributor

timvandermeij commented Oct 6, 2016

Awesome!

@NinjaKC
Copy link

NinjaKC commented Oct 19, 2016

Awesome, you guys are!

The initial bug of IE only printing half a page seems to be fixed with this new update.

Except, I do not believe this is fully off the table yet (frowns at IE). I am using pdf.js version 1.6.258 and have also tested the above 1.6.218 against a few documents I am trying to get this to work with, and I see the following 2 things happening...

  1. When loading the viewer.html into a tab within IE 11.633.10586.0 the pages we have overflow onto an additional page and leaves blank pages every other page being printed.
  2. When loading the viewer.html into an iframe within IE 11.633.10586.0 the pages we have fit within their expected print pages without overflowing, except they are way smaller. They add a large margin & take up only a quarter of the available print page space.

I realize these are 2 separate issues, just noting them here since all the above issues are what I have been following. Unfortunately the documents in question contain sensitive information and I am unable to just post some links at this time, I will try and re-produce the above with links using a different document and open proper issue reports.

I appreciate all the work you guys are doing to solve IE's unruly issues!
Thanks!

@yurydelendik
Copy link
Contributor Author

yurydelendik commented Oct 19, 2016

There is nothing can be done about issues above -- browser does not inform about pages it prints. What we can do is detect if browser has top/bottom margins, truncate images from top/bottom or prescale it (Notice that you can scale it in IE during printing to avoid the problem). Safari for Mac OSX has the similar issue.

@NinjaKC
Copy link

NinjaKC commented Oct 20, 2016

For number 1 above, I believe I understand what the issue may be, though pdf.js in any browser but IE handles the page height without issues, I can even set it in the PDF to 350mm and it works in all browsers, but for IE it stops just short or defaults back to the A4 paper size height which is 297mm. I will research more before claiming it to be a pdf.js issue and will report back.

For number 2 above, when the viewer is in an iframe, the printed result is a little larger then a quarter of the page (width and height). I have not been able to look further into this, but am able to show it happening even with your default pdf provided with the viewer. When I get a chance to look into this further, I will provide an issue report if its pdf.js' issue.

Either way, thanks again for your hard work guys.

@madhav1985
Copy link

When we try to load the .msg file with landscape from pdf.js using chrome browser the quality of the print is not fine and it becomes blur and unable to read the content is their any solution for this.
Step1 :- We shrinked the content of the page to set in to the widht of the pdf using c++ dlls and then we are trying to print the shrinked contents in lanscape mode but pdf.js the file content is blur in print prieview.

Same pdf document if we print outside it is working fine is their any solution for this.

Thanks
Madhavan
madhav1985@gmail.com

movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
Bug 1302069 - Printing canvases at PDF document size.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants