Skip to content
Guides

Extract Pages

This example shows how to extract pages:

swift
var indexSet = IndexSet()
indexSet.insert(0)

let extractDocument = CPDFDocument()
// Extract the first page of the original document and save it in a new document.
extractDocument?.importPages(index, from: document, at: 0)
objective-c
NSMutableIndexSet *indexSet = [NSMutableIndexSet indexSet];
[indexSet addIndex:0];

CPDFDocument *extractDocument = [[CPDFDocument alloc] init];
// Extract the first page of the original document and save it in a new document.
[extractDocument importPages:indexSet fromDocument:document atIndex:0];