예제 #1
0
        public override void LaunchExample(Context ctx, PdfActivityConfiguration.Builder configuration)
        {
            // Our test certificate is self-signed, so we need to add it to trusted certificate store for it to validate. Otherwise
            // the new signature won't validate. Since PSPDFKit and other readers (like Acrobat) will warn when using self-signed certificates
            // your app should use a CA issued certificate instead.
            AddJohnAppleseedCertificateToTrustedCertificates(ctx);

            // The signer is a named entity holding a certificate (usually a person) and has a display name shown in the app. Registration of the Signer instance
            // has to happen using a unique string identifier. The signer can be associated with a signature for signing the document.
            var johnAppleseed = new Pkcs12Signer("John Appleseed", Android.Net.Uri.Parse("file:///android_asset/JohnAppleseed.p12"));

            SignatureManager.AddSigner("john_appleseed", johnAppleseed);

            // Load and show the signature example PDF.
            // Extract the pdf from assets if not already extracted
            var docUri = Utils.ExtractAsset(ctx, AssetPath);

            var intent = PdfActivityIntentBuilder.FromUri(ctx, docUri)
                         .Configuration(configuration.Build())
                         .Build();

            ctx.StartActivity(intent);
        }