public override void LaunchExample(Context ctx, PdfActivityConfiguration.Builder configuration) { Task.Factory.StartNew(async() => { AndHUD.Shared.Show(ctx, $"Downloading file....", cancelCallback: client.CancelPendingRequests); PrepareConfiguration(configuration); var docUrl = "https://pspdfkit.com/downloads/case-study-box.pdf"; var docPath = Path.Combine(ctx.CacheDir.ToString(), AssetPath); using (var file = new FileStream(docPath, FileMode.Create, FileAccess.Write, FileShare.None)) await client.DownloadDataAsync(docUrl, file); AndHUD.Shared.Dismiss(ctx); var jfile = new Java.IO.File(docPath); var docUri = Android.Net.Uri.FromFile(jfile); // Start the PSPDFKitAppCompat activity by passing it the Uri of the file. if (PSPDFKitGlobal.IsOpenableUri(ctx, docUri)) { PdfActivity.ShowDocument(ctx, docUri, configuration.Build()); } else { AndHUD.Shared.ShowError(ctx, $"This document uri cannot be opened:\n{docUri}", MaskType.Black, TimeSpan.FromSeconds(2)); } }); }
public override void LaunchExample(Context ctx, PdfActivityConfiguration.Builder configuration) { // In this example we use a custom activity to build an intent that allows the user to // select a document. var intent = new Intent(ctx, typeof(ExternalExampleActivity)); intent.PutExtra(ExternalExampleActivity.ExtraConfiguration, configuration.Build()); ctx.StartActivity(intent); }
public override void LaunchExample(Context ctx, PdfActivityConfiguration.Builder configuration) { // Instant example starts with a simple login/connection screen. var intent = new Intent(ctx, typeof(InstantExampleConnectionActivity)); // Pass the configuration to the connection activity. This configuration will // be passed to created InstantPdfActivity with downloaded Instant document. intent.PutExtra(InstantExampleConnectionActivity.ConfigurationArg, configuration.Build()); ctx.StartActivity(intent); }
public override void LaunchExample(Context ctx, PdfActivityConfiguration.Builder configuration) { // Create an instance of the custom data provider. See the implementation details below. var dataProvider = new RawResourceDataProvider(Resource.Raw.guide); // Start the activity using our data provider. var intent = PdfActivityIntentBuilder.FromDataProvider(ctx, dataProvider) .Configuration(configuration.Build()) .Build(); ctx.StartActivity(intent); }
public override void LaunchExample(Context ctx, PdfActivityConfiguration.Builder configuration) { PrepareConfiguration(configuration); // Extract the pdf from assets if not already extracted var docUri = Utils.ExtractAsset(ctx, AssetPath); var intent = PdfActivityIntentBuilder.FromUri(ctx, docUri) .Configuration(configuration.Build()) .ActivityClass(Java.Lang.Class.FromType(typeof(FormFillingActivity))) .Build(); ctx.StartActivity(intent); }
public virtual void LaunchExample(Context ctx, PdfActivityConfiguration.Builder configuration) { // Extract the pdf from assets if not already extracted var docUri = Utils.ExtractAsset(ctx, AssetPath); PrepareConfiguration(configuration); // Start the PSPDFKitAppCompat activity by passing it the Uri of the file. if (PSPDFKitGlobal.IsOpenableUri(ctx, docUri)) { PdfActivity.ShowDocument(ctx, docUri, configuration.Build()); } else { AndHUD.Shared.ShowError(ctx, $"This document uri cannot be opened:\n{docUri}", MaskType.Black, TimeSpan.FromSeconds(2)); } }
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); }