-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Make Popup annotations always have noRotate flag set as true #20043
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
Conversation
@yyliu12 would you mind to update your patch in order to take into account: #20043 (comment) ? |
In addition to the above, please also add a reference test for this behavior to avoid regressions. You can add the file you already created to This will look something like the one added in c5449a9#diff-bbeef90df04bff7617f7ef59e3f37cac92192c5169bc500d857bd6fb107fcabd and should consist of the PDF file itself, the Finally, make sure to add |
8e4347c
to
c4685a1
Compare
All done. Please let me know if anything is not to snuff. |
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @calixteman received. Current queue size: 1 Live output at: http://54.241.84.105:8877/5238ed11ea98021/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/5238ed11ea98021/output.txt Total script time: 30.40 mins
|
/botio-linux preview |
From: Bot.io (Linux m4)ReceivedCommand cmd_preview from @timvandermeij received. Current queue size: 0 Live output at: http://54.241.84.105:8877/b7126efa1f7f4d5/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/b7126efa1f7f4d5/output.txt Total script time: 0.98 mins Published |
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.
The change looks good to me now, but before we merge this please put the nice context from the PR description (in a summarized way) in the commit message itself so it's also visible using e.g. git log
for future reference.
Thank you for your contribution!
Necessary because when there is no Popup annotation created along with a Text annotation, the Popup annotation created by pdf.js does not receive the noRotate flag
c4685a1
to
d8ecfad
Compare
/botio makeref |
From: Bot.io (Linux m4)ReceivedCommand cmd_makeref from @calixteman received. Current queue size: 0 Live output at: http://54.241.84.105:8877/93b39418842916c/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_makeref from @calixteman received. Current queue size: 0 Live output at: http://54.193.163.58:8877/4653081775128fd/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/93b39418842916c/output.txt Total script time: 15.99 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/4653081775128fd/output.txt Total script time: 23.97 mins
|
In PDF, pages can be rotated using their Rotate property (7.7.3.3). An annotation on a PDF can have a NoRotate flag set, in which case the annotation will not rotate (12.5.3). The PDF specification also requires that some annotations will always have the NoRotate flag set, including the Text annotation (12.5.6.4).
The NoRotate flag was implemented in PDF.js in pull request #16110. However, the implementation only works if a PDF editor creates both a Popup annotation and a Text annotation. Adobe Acrobat does this. However, some PDF editors only create a Text annotation. Even if the Text annotation has the NoRotate flag set, the popup created by PDF.js will not have the NoRotate flag. This is because the annotation layer does not pass the NoRotate flag to the Popup object when creating it. This pull request fixes that.
I have created a test PDF with a single page that has the Rotate property set. The left comment was created using Adobe Acrobat while the right comment was created using a PDF editor that does not create the Popup annotation.
Here's how the right comment renders in Acrobat:
Here's how it displays in the version of pdf.js available at mozilla.github.io:
And here's how it displays in pdf.js after applying the code attached to this pull request:
Test PDF: Testing file.pdf