Password protect PDFs in Kotlin for Android
An example, password-protected PDF document. The password is: test123 Get additional resources by visiting our guide on opening password-protected PDFs in Android.
/* * Copyright © 2020-2025 PSPDFKit GmbH. All rights reserved. * * The PSPDFKit Sample applications are licensed with a modified BSD license. * Please see License for details. This notice may not be removed from this file. */
package com.pspdfkit.catalog.examples.kotlin
import android.content.Contextimport com.pspdfkit.catalog.Rimport com.pspdfkit.ui.PdfActivity
/** * Shows the [PdfActivity] with a password protected document loaded. */class PasswordExample(context: Context) : AssetExample(context, R.string.passwordExampleTitle, R.string.passwordExampleDescription) { override val assetPath: String get() = "password.pdf"}
This code sample is an example that illustrates how to use our SDK. Please adapt it to your specific use case.