[
https://issues.apache.org/jira/browse/PDFBOX-4310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16603460#comment-16603460
]
Tilman Hausherr commented on PDFBOX-4310:
-----------------------------------------
You need to also remove the invoke ("Do") in the content stream (only if the
name references an image, and not a form xobject), have a look at the PDF with
PDFDebugger. But I doubt you will be happy with the result. For example, image
"Im7" also contains the image of a text "Internet & democracy". The Berkman
logo is a combination of images and vector graphics.
> Remove all images from a page
> -----------------------------
>
> Key: PDFBOX-4310
> URL: https://issues.apache.org/jira/browse/PDFBOX-4310
> Project: PDFBox
> Issue Type: Wish
> Affects Versions: 2.0.11
> Reporter: Alexandre
> Priority: Minor
> Labels: how-to
> Attachments: 8325f992-15ff-4cdb-afed-0d8068c67ddc.pdf
>
>
> Hello Apache contributors,
> I am looking forward to remove all images from a pdf page (= create a new
> page without images from the original)
> For the moment, I am trying the following and it is not working. What's
> missing?
> {code:java}
> PDPage page = document.getPage(p);
> PDResources resources = page.getResources();
> resources.getXObjectNames().forEach((cosName) -> {
> PDXObject image;
> try {
> image = resources.getXObject(cosName);
> if (resources.isImageXObject(cosName)) {
> resources.getCOSObject().removeItem(cosName);
> page.setResources(resources);
> page.getCOSObject().removeItem(cosName);
> }
> }
> catch (IOException e) { }
> });
> {code}
> Best, A.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]