Disabling Adding Pages with Images

You might want to disable letting a user add new pages from their Photo Library or the Camera in Document Editor.

To do this, you can remove the item outlined in red in the screenshot above by filtering out the page template with the image identifier from the pageTemplates of the documentEditorConfiguration of the main PSPDFKit configuration.

let pdfViewController = PDFViewController(document: document) { mainConfigBuilder in
    mainConfigBuilder.documentEditorConfiguration = mainConfigBuilder.documentEditorConfiguration.configurationUpdated { docEditorConfigBuilder in
        docEditorConfigBuilder.pageTemplates = docEditorConfigBuilder.pageTemplates.filter { pageTemplate -> Bool in
            pageTemplate.identifier != .image
        }
    }
}