-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Support printing page with different rotation #6103
Conversation
de40574
to
11ba331
Compare
Thanks for the PR. I'll put reviewing it on my to-do list. |
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://107.21.233.14:8877/60608bee397dc6f/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/60608bee397dc6f/output.txt Total script time: 0.70 mins Published |
Looks okay. I'm still not sure about isFirstPagePortrait-parameter-logic usage. Shall we make that decision before printing and use it e.g. as |
@yurydelendik The purpose of this patch is to allow pages with varying orientation levels to be printed correctly. For that specific purpose and the given test cases, the patch looks OK to me, but I'm not completely certain whether this special case is always warranted in its current form. For instance, if a PDF is approximately a square (e.g. presentation slides), then flipping the pages because e.g. |
I see -- I was confused about the parameter name, ignore my concern :) |
Anything preventing this from being merged? |
@Hengjie Yes, the question whether unconditionally rotating a page makes sense. I can obviously see that the patch has the desired effect for the provided test PDF files, but I'm not convinced whether it makes sense to unconditionally rotate all pages whose orientation is slightly different (see my previous comment, 6103#issuecomment-117242076). Another example is a set of pictures that are so small that it doesn't matter whether the page is rotated when printed. Well, after applying your logic, the images will always be rotated, unconditionally. Do you have any data on distribution of page sizes/orientations for PDF files? |
@Hengjie Ping for an answer to my last question (July, 24th) and implementation of my suggestion from 30th of June. |
11ba331
to
c9e0d39
Compare
I don't have any data about PDF file page sizes but I am unable to see the disadvantage of rotate page with size of 500x501? The result won't be much different and I can't think any case when user doesn't want the auto rotate behaviour. Even there are some edge cases, this PR still fixes more than it breaks so I think the trade-off is worth it. |
@xlc With my given example, if I print the slides of a presentation that perfectly fit on a page, it would be odd to have them rotated. It might be a good idea to add a new preference to disable auto-rotating, to allow users / embedders to choose whether to rotate a page. |
@Rob--W Sorry I still can't see why auto-rotate is bad. But if you insist the change is necessary, I can still do it. Just give me the value of |
I do not want to rotate the slides when not needed (e.g. when PDFs with irregular pages are printed with a printer that automatically puts a staple on the result). But maybe I'm worrying about nothing, so let's not use those magic numbers for now and see how it goes. The patch looks good to me. |
c9e0d39
to
51f147f
Compare
@Rob--W Updated |
@xlc Could you squash the commits into one commit? See https://github.com/mozilla/pdf.js/wiki/Squashing-Commits if you're not familiar with that. |
51f147f
to
61bd8d2
Compare
61bd8d2
to
83578f8
Compare
Hi guys ! So when is this going to be live ? |
I don't know why this patch was not merged. @timvandermeij After your comment this PR was updated but not merged, why? (the PR needs to be rebased now due to bit rot) |
Did someone forget to confirm a merge request ? |
I think I just forgot about this after asking about squashing since it was assigned to @Rob--W. Sorry for that. Now that I look at this again, I'm not entirely sure if we need to make this a preference, i.e., why would one want to disable this? If we do keep this a preference, we should be able to remove the hash parameter change as we don't use them anymore. I think this patch is good to go after a rebase, simplification and testing to ensure it still works as intended after the rebase (since the printing code changed quite a bit after this patch). |
If pages are irregularly shaped, then it does not make sense to rotate pages. PDFs are supposed to closely match the printed result, so I believe that a change as significant as rotating a page should be customizable. |
Good point. Let's keep the preference, but only remove https://github.com/mozilla/pdf.js/pull/6103/files#diff-dd42e9b2d2a652b8e312efa567698aa6R1454 since we don't really use the hash parameters anymore. |
Sorry guys I won't be able to maintain this PR anymore. I haven't worked with pdf.js for long time and a quick rebase shows that there too many changes in the code structure and I don't have time to deal with it. Feel free to take whatever code you need from this PR to make a new one. |
So, as a conclusion, is PDF.js going to support printing a PDF with different orientations ? |
It will if someone has time to redo this patch. Until then, the issue is tracked in #6696. |
This PR fixed a printing issue on document that contains page with different orientation.
Some page may print upside down, but rotate a printed paper sheet shouldn't be a problem.
@Rob--W This is the PR you and @Hengjie discussed in #5857
Some test pdfs:
https://drive.google.com/a/notable.ac/file/d/0B6YhVF9p-y2AbUJlcEI5ZGZ5Z2c/view?usp=sharing
https://drive.google.com/a/notable.ac/file/d/0B6YhVF9p-y2AQTNxMVVOekJYeFE/view?usp=sharing