Some test text!

Discord Logo

Chat with us

PDFTron is now Apryse, learn more here.

iOS / Guides / Remove content


PDFTron is now Apryse, learn more here.

Removing images from PDF page on iOS

To remove all images from a document page.

PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilepath: filename];
PTPage *page = [doc GetPage:1];

PTElementWriter *writer = [[PTElementWriter alloc] init];
PTElementReader *reader = [[PTElementReader alloc] init];
[reader Begin: page];
[writer Begin: page placement: e_ptreplacement page_coord_sys: NO];

PTElement *element;	
while ((element = [reader Next])) 	// Read page contents
    switch ([element GetType])
        case e_ptimage: 
        case e_ptinline_image: 
            // remove all images by skipping them			
            [writer WriteElement: element];

[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