简体   繁体   中英

Python remove shapes from a pdf

In my setup, I have a student submit a pdf, and the teacher can annotate the pdf using the adobe embed api. This really nice since the teacher can create and delete comments.

However, take the example case where a student writes their answers on a paper then scans them to a pdf. They then draw on the pdf with a pdf editor like Microsoft edge. after they submit and the teacher is editing, it is possible for the teacher to delete what the student has drawn because the embed API treats it as a shape. I don't want this to be possible.

My backend is Django, so maybe there is some way for python to open a pdf file and "flatten" the shapes.

Thanks

The Embed API has an annotations API, and as part of that, you can delete them ( https://developer.adobe.com/document-services/docs/overview/pdf-embed-api/howtos_comments/#deleteannotations-api ). You would need to build the UI yourself to provide a way for a user to select an annotation and remote it. The API covers everything (getting, adding, deleting), so it's just up to you to build it out.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM