Password Not Preset

Trying to load a password-protected document without providing the passwort will trigger a dialog. Password is 'test123'. Get additional resources by visiting our guide on opening password-protected PDFs in iOS.


//
// Copyright © 2017-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 PasswordNotPresetExample: Example {
override init() {
super.init()
title = "Password not preset"
contentDescription = "Dialog will be shown. Password is 'test123'"
category = .security
}
override func invoke(with delegate: ExampleRunnerDelegate) -> UIViewController {
let document = AssetLoader.document(for: "Password-Protected.pdf")
return PDFViewController(document: document)
}
}

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