On this page
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, .path])
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 | CEditingLoadTypePath];
Explanation of Editing Mode
Here is the explanation of the editing mode settings:
Editing Mode | Description | Parameters |
---|---|---|
Text Mode | In 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 Mode | In 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 |
Path Mode | In path mode, the path in the PDF document can be selected, which can be cut, copied, moved, deleted, and so on. | CEditingLoadTypePath |
Text & Image &Path Mode | In text , image and path 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|CEditingLoadTypePath |