Get the RemoveAllText.java example from the source code download, then modify it so that it catches the "Do" operator. For example "/Im4 Do". Here "Im4" is the name of the image. Rewrite the content stream without these two tokens. If you want to delete the image from the resources (because it is secret), then you have to access the resources somewhat like this:

page.getResources().getCOSObject().getDictionaryItem(COSName.XObjects).RemoveItem(COSName.getPDFName("Im4"));

This is a simple example; in might be more tricky in practice, e.g. if the image is not at the top hierarchy, or if it isn't an image at all.

Tilman

Am 28.12.2019 um 16:00 schrieb moe mezzawi:
Dear All,

How can we delete an image from a pdf?

Thanks.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to