Disable Bookmark Editing in PDF using Swift for iOS

Disable bookmark editing using Document Features. Get additional resources by visiting our guides on PDF Document Features.


//
// Copyright © 2018-2025 PSPDFKit GmbH. All rights reserved.
//
// The Nutrient sample applications are licensed with a modified BSD license.
// Please see License for details. This notice may not be removed from this file.
//
import PSPDFKit
import PSPDFKitUI
class DisableBookmarkEditingExample: Example {
override init() {
super.init()
title = "Disable Bookmark Editing"
contentDescription = "Shows how to disable bookmark editing using Document Features"
category = .subclassing
priority = 260
}
override func invoke(with delegate: ExampleRunnerDelegate) -> UIViewController {
let document = AssetLoader.writableDocument(for: .welcome, overrideIfExists: false)
// Add the custom source to the document's features.
let documentFeaturesSource = DisableBookmarkEditingDocumentFeaturesSource()
document.features.add([documentFeaturesSource])
let controller = PDFViewController(document: document)
controller.navigationItem.setRightBarButtonItems([controller.outlineButtonItem], animated: false)
return controller
}
}
private class DisableBookmarkEditingDocumentFeaturesSource: NSObject, PDFDocumentFeaturesSource {
weak var features: PDFDocumentFeatures?
// Return false to disable bookmark editing.
var canEditBookmarks: Bool {
false
}
}

This code sample is an example that illustrates how to use our SDK. Please adapt it to your specific use case.