-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Allow automatic print rotation via the enablePrintAutoRotate preference #8043
Allow automatic print rotation via the enablePrintAutoRotate preference #8043
Conversation
Determine the page rotation at the same place as where the page size is determined. This allows us to implement custom print page rotation logic in one place, in the future.
/botio-linux preview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solution looks really clean! After addressing the comment, I'll do more testing before approving this.
web/app.js
Outdated
@@ -1457,6 +1460,9 @@ function webViewerInitialized() { | |||
if ('useonlycsszoom' in hashParams) { | |||
PDFJS.useOnlyCssZoom = (hashParams['useonlycsszoom'] === 'true'); | |||
} | |||
if ('printautorotate' in hashParams) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the hash parameter addition. The hash parameters are only used for debugging purposes, not for toggling features. Moreover, using the preferences for this is preferred and quite a few hash parameters have already been removed before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you test the parameter in the web viewer without the hash param? I only added it in order to test it from the test server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you test the parameter in the web viewer without the hash param?
E.g. by executing PDFViewerApplication.preferences.set('enablePrintAutoRotate', {true, false});
in the console and then reloading the viewer.
Furthermore, we shouldn't be adding new things to PDFJS
especially not in the viewer, since the usage of PDFJS
will most likely be removed in future PDF.js versions.
Can we please just pass the preference into PDFViewer
in the same way as e.g. the enhanceTextSelection
preference is handled instead!?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Can you please also add a JSDoc comment for the new PDFViewer
parameter at https://github.com/mozilla/pdf.js/blob/master/web/pdf_viewer.js#L69?
5ea1dfd
to
f95827c
Compare
/botio-linux preview |
f95827c
to
ece44d3
Compare
/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/47ff66d588af8e9/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/47ff66d588af8e9/output.txt Total script time: 2.17 mins Published |
Thank you for implementing this! |
I'm not sure if I'm reading all of this correctly. I have my default pdf view set as "Preview in Firefox." When I print from that viewer, the pdf prints in whatever orientation my printer settings are set at. My printer dialog does not allow me to auto detect page orientation for printing, so in order to change the orientation I have to do it on a per document basis. I tried the solution for PDFViewerApplication.preferences.set('enablePrintAutoRotate', true), but when I run about:config, I do not find either portion of that as an option in my list of commands. I am running Windows 10 and trying to dump Chrome because it lags so badly, but this printing issue is a major issue that will keep me from changing. Can you help? |
I have |
Thank you for your quick response!
If it will resolve this one problem for me, do you think I should add the
developer add-on? I have had so much trouble with Chrome, and it's gotten
to the point that I just want to dump it. This issue is my only hold-up
with Firefox.
…____________________________________________________________
___________________________
On Tue, Jun 13, 2017 at 4:45 PM, Tim van der Meij ***@***.***> wrote:
I have ***@***.*** in about:config,
but that is most likely because I have the development add-on installed.
I'm not sure how to find it using the regular Firefox build. Maybe others
have an idea here? If it works well, we may also consider enabling it by
default in a separate issue.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#8043 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AcC8P3iqkOs9836uqw9-1OOFh9dR0Ahiks5sDvT_gaJpZM4L6LKj>
.
|
|
Firefox 54 per https://bugzilla.mozilla.org/show_bug.cgi?id=1338395 |
@Piita It is recommended to just update to Firefox 54. Per the link above, it should have the |
Okay, I don't know what I'm doing wrong. I've updated to Firefox 54. I have
the following settings in about:config -
print.use_global_printsettings;false
pdfjs.enablePrintAutoRotate;true
The problem I'm having is that when I preview a PDF file attached to a
Gmail email, I have it set to "Preview in Firefox" so I assume it's using
Firefox's pdf viewer. When I view it and click on the printer icon in the
viewer screen, it shows it in the proper landscape orientation, but when it
prints it prints in portrait orientation; I assume it does this because my
the setting on the printer itself defaults to portrait, and the print
dialog in Firefox also defaults to portrait. This is why I set
print.use_global_printsettings set to False, and wanted pdfjs.
enablePrintAutoRotate set to True. Then, I restarted Firefox, opened the
email message, viewed the PDF document in landscape, and it printed in
portrait. I don't know what else to do. Is there any other setting that I
need to pay attention to? I don't want to set my default to landscape,
because not everything I print is in landscape. I don't want to have to
manually change the print orientation for each document. I don't have to do
that in Chrome or IE, which right now is their only saving grace.
Attached is an example of the document in question. Maybe you can tell what
else I can try?
…_______________________________________________________________________________________
On Wed, Jun 14, 2017 at 6:15 PM, Tim van der Meij ***@***.***> wrote:
@Piita <https://github.com/piita> It is recommended to just update to
Firefox 54. Per the link above, it should have the
pdfjs.enablePrintAutoRotate key in about:config then so you can toggle
it. There should be no need to install the developer add-on.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8043 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AcC8PxdEuF89T-I1E6J4H1vWUfRJuTy6ks5sEFuCgaJpZM4L6LKj>
.
|
@Piita, auto-rotate relates to how pages 2-n are drawn in relation to page 1. In other words, if page 1 is portrait and page 2 is landscape, page 2 will be rotated rather than shrunk-to-fit. However, pdf.js does not auto-detect the current page setup and rotate the first page in relation to that setting. That's issue #2851. |
Allow automatic print rotation via the enablePrintAutoRotate preference
Tests:
gulp server
PDFViewerApplication.preferences.set('enablePrintAutoRotate', true);
and refresh.false
instead oftrue
, then perform step 4 and confirm that the page rotation did not change.Fixes #6696, supersedes #6103