pdfbox-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexandre (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (PDFBOX-4310) Remove all images from a page
Date Tue, 04 Sep 2018 16:22:00 GMT

     [ https://issues.apache.org/jira/browse/PDFBOX-4310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Alexandre updated PDFBOX-4310:
------------------------------
    Description: 
Hello Apache contributors,

I am looking forward to remove all images from a pdf page.

For the time being, I am doing 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}

  was:
Hello Apache contributors,

I am looking forward to remove all image from a pdf page.

For the time being, I am doing 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}


> Remove all images from a page
> -----------------------------
>
>                 Key: PDFBOX-4310
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4310
>             Project: PDFBox
>          Issue Type: Wish
>          Components: PDModel
>    Affects Versions: 2.0.11
>            Reporter: Alexandre
>            Priority: Minor
>             Fix For: 1.8.16
>
>
> Hello Apache contributors,
> I am looking forward to remove all images from a pdf page.
> For the time being, I am doing 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}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Mime
View raw message