Some test text!

Loading...
Guides
Remove content

Removing images from PDF page in Android

To remove all images from a document page.

PDFDoc doc = new PDFDoc(filename);
Page page = doc.getPage(1);

ElementWriter writer = new ElementWriter();
ElementReader reader = new ElementReader();
reader.begin(page);
writer.begin(page, ElementWriter.e_replacement, false);

Element element;
while ((element = reader.next()) != null) 
{
    switch (element.getType()) 
    {
        case Element.e_image:
        case Element.e_inline_image:
            // remove all images by skipping them
            break;
        default:
            writer.writeElement(element);
            break;
    }
}

writer.end();
reader.end();

PDF Editor (Programmatic)
Full code sample which strips all images from the page and changes text color to blue.

Get the answers you need: Support

Upcoming Webinar: SDK Features Preview and Live Run-Through | July 14, 2022 at 11 am PT

PDFTron SDK

The Platform

NEW

© 2022 PDFTron Systems Inc. All rights reserved.

Privacy

Terms of Use