-
-
Notifications
You must be signed in to change notification settings - Fork 656
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
Cleanup all annotations #750
Conversation
The error with the annotations does not only affect printing, "save as" is also not possible in Acrobat Reader and Acrobat Pro with a flattened pdf. In addition, e.g. the validation of the PDF with Datalogic's PDF Checker fails: "Unable to process document due to PDF Error". |
@btecu Can you clarify what is being done here? It looks like this logic would just delete the first annotation from a page after flattening a widget that belonged to it. If that is the intent, can you explain why that would be desirable? There's not necessarily any correlation between the first annotation on a page and the widget being flattened. |
Can you provide a sample document that fails to be printed after flattening? Does this only happen to certain documents, or to all documents? |
@Hopding Notice the loop - is deleting all annotations. As a sample, take a look at the document in the flattening test. It doesn't appear to be a special document but the issue happens with most PDFs that have a form. |
Ah, I see the loop now. Deleting all the annotations seems like overkill. I don't think users would expect that flattening a form would result in all pages with fields losing their annotations. |
Looks like the field annotations are the ones that were causing the issue. Removing those along with the widget annotations seems to have fix the issue. In addition, I've improved |
Enhance `removeField` to cleanup annotations
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.
@btecu This looks very good. The implementation is nice. I've requested one change and then this should be good to go.
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.
Thanks for working on this @btecu!
* Remove all fields & widget annotations when flattening Enhance `removeField` to cleanup annotations * Add `removeField` test
Most viewers, including
PDF.js
andPreview
do not seem to mind the annotations but it was preventingAdobe Acrobat
printing a flattened document: