Interactive editing of images on a PDF page via PDFViewCtrl

Q: Is there a way of interacting with embedded and inline PDF images. We want to interact with images almost similar to the interaction with annotations.


PDFViewCtrl does not offer a built-in UI mechanism for interacting/editing images referenced in the page content stream, but I have a couple of suggestions about how to implement one. The “easiest” would be to use ElementReader to read through the entire PDF, removing images that are encountered and using the Stamper class to re-create the images as annotations using the Stamper class. The normal annotation UI code could then be used to move/resize/delete the images. The only potential problem is that all of the images will be floated above the rest of the PDF content, which may or may not be acceptable. A second but more difficult method that could maintain the z-ordering of the images would be to identify images on a case-by-case basis as a user interacts with a document (again using element reader), and change an image’s position (or other properties) based on the user’s input directly within the PDF content.

For example code showing the use of ElementReader, ElementWriter and the Stamper classes, please see our sample code page here: If you have any specific questions about the classes or their use, please let me know.