For the complete documentation index, see llms.txt. This page is also available as Markdown.

Removing pages from PDFs on iOS

To remove pages from a PDF document.

PTPDFDoc *doc = [[PTPDFDoc alloc] initWithFilepath: filename];

// Remove the fifth page from the page sequence.
[doc PageRemove: [doc GetPageIterator:5]];

// Remove the third page.
PTPageIterator *i = [doc getPageIterator];
[i Next];
[i Next];
[doc PageRemove: i];
let doc: PTPDFDoc = PTPDFDoc(filepath: filename)

// Remove the fifth page from the page sequence.
doc.pageRemove(doc.getPageIterator(5))

// Remove the third page.
let i: PTPageIterator = doc.getPageIterator()
i.next()
i.next()
doc.pageRemove(i)

Merge, copy, delete, and rearrange PDF pages Full code sample which illustrates how to copy pages from one document to another, how to delete, and rearrange pages and how to use ImportPages().

About removing/deleting pages

PDFDoc.PageRemove(itr) only removes the page from document's page sequence. The page and its resources are still available until the document is saved in 'full save mode' with the 'remove unused objects' flag. If you are saving the file in 'incremental mode', the serialized document may contain the content of the removed page.

Last updated

Was this helpful?