Removing images from PDF page on iOS

To remove all images from a document page.

1PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilepath: filename];
2PTPage *page = [doc GetPage:1];
3
4PTElementWriter *writer = [[PTElementWriter alloc] init];
5PTElementReader *reader = [[PTElementReader alloc] init];
6[reader Begin: page];
7[writer Begin: page placement: e_ptreplacement page_coord_sys: NO];
8
9PTElement *element;
10while ((element = [reader Next])) // Read page contents
11{
12 switch ([element GetType])
13 {
14 case e_ptimage:
15 case e_ptinline_image:
16 // remove all images by skipping them
17 break;
18 default:
19 [writer WriteElement: element];
20 }
21}
22
23[writer End];
24[reader End];

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

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales