Skip to content
Guides

Initialize Editing Mode

Before performing PDF content editing, you should initialize the content editing mode.

This example shows how to initialize editing mode:

swift
var document = CPDFDocument(url: URL(string: "filePath"))
let page = document?.page(at: 0)

let pdfView = CPDFView(frame: self.view.bounds)
    
// Set the document to be displayed.
pdfView?.document = document
pdfView?.beginEditingLoadType([.text, .image])
objective-c
NSURL *url = [NSURL fileURLWithPath:pdfPath];
CPDFDocument *document = [[CPDFDocument alloc] initWithURL:url];

CPDFView *pdfView = [[CPDFView alloc] initWithFrame:self.view.bounds];

// Set the document to be displayed.
pdfView.document = document;
[pdfView beginEditingLoadType:CEditingLoadTypeText | CEditingLoadTypeImage];

Explanation of Editing Mode

Here is the explanation of the editing mode settings:

Editing ModeDescriptionParameters
Text ModeIn text mode, the text blocks surrounded by dotted lines will be displayed in the PDF document. Users can select text blocks and add, delete, copy, and paste text.CEditingLoadTypeText
Image ModeIn image mode, the images surrounded by dotted lines will be displayed in the PDF document. Users can select images and then delete, crop, rotate, mirror, replace, save images, or set image properties.CEditingLoadTypeImage
Text & Image ModeIn text and image mode, the text blocks and images surrounded by dotted lines will be displayed in the PDF document. Users can select and edit both text and images.CEditingLoadTypeText|CEditingLoadTypeImage