├── .gitignore ├── Images ├── AndroidSimple.png ├── Catalog.png ├── Instant-desktop.png ├── Instant-device.png ├── Project-setup.png └── XForms.png ├── LICENSE.md ├── PSPDFKit.Android.sln ├── PSPDFKit.Android ├── Additions │ ├── AboutAdditions.txt │ ├── AnnotationCreationToolbar.cs │ ├── AnnotationEditingToolbar.cs │ ├── BaseRectsAnnotation.cs │ ├── CtorsWorkaround.cs │ ├── DocumentEditingToolbar.cs │ ├── InstantPdfActivity.cs │ ├── RedactionAnnotation.cs │ └── TextSelectionToolbar.cs ├── Jars │ └── AboutJars.txt ├── PSPDFKit.Android.csproj ├── Properties │ └── AssemblyInfo.cs └── Transforms │ ├── EnumFields.xml │ ├── EnumMethods.xml │ └── Metadata.xml ├── README.md ├── build.cake ├── build.ps1 ├── build.sh ├── ci └── pipelines │ └── release.yml ├── nuget ├── PSPDFKit.Android.targets ├── icon.png ├── pspdfkit-android.nuspec └── readme.txt └── samples ├── AndroidSample ├── AndroidSample.sln └── AndroidSample │ ├── AndroidSample.csproj │ ├── Assets │ ├── AboutAssets.txt │ └── demo.pdf │ ├── DocumentHelper.cs │ ├── MainActivity.cs │ ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs │ ├── Resources │ ├── AboutResources.txt │ ├── drawable-hdpi │ │ ├── Icon.png │ │ └── xamagon.png │ ├── drawable-mdpi │ │ ├── Icon.png │ │ └── xamagon.png │ ├── drawable-xhdpi │ │ ├── Icon.png │ │ └── xamagon.png │ ├── drawable-xxhdpi │ │ ├── Icon.png │ │ └── xamagon.png │ ├── drawable-xxxhdpi │ │ ├── Icon.png │ │ └── xamagon.png │ ├── layout │ │ └── Main.axml │ └── values │ │ ├── Colors.xml │ │ ├── Strings.xml │ │ └── Styles.xml │ └── pspdfkit-proguard.cfg ├── PSPDFCatalog ├── Assets │ ├── A_encrypted.pdf │ ├── AboutAssets.txt │ ├── Form_example.pdf │ ├── JohnAppleseed.p12 │ └── password.pdf ├── Catalog │ ├── Activities │ │ ├── CustomFormHighlightColorActivity.cs │ │ ├── CustomFragmentActivity.cs │ │ ├── ExternalExampleActivity.cs │ │ └── FormFillingActivity.cs │ ├── BasicExample.cs │ ├── CustomDataProviderExample.cs │ ├── CustomFormHighlightColorExample.cs │ ├── DigitalSignatureExample.cs │ ├── DocumentDownloadExample.cs │ ├── ExternalDocumentExample.cs │ ├── FormFillingExample.cs │ ├── FragmentExample.cs │ ├── Instant │ │ ├── Activities │ │ │ ├── InstantExampleActivity.cs │ │ │ └── InstantExampleConnectionActivity.cs │ │ ├── InstantExample.cs │ │ └── WebPreviewApiClient.cs │ └── PasswordExample.cs ├── Helpers │ ├── HttpClientProgressExtensions.cs │ ├── MyGlobalLayoutListener.cs │ └── Settings.cs ├── MainActivity.cs ├── PSPDFCatalog.csproj ├── PdfExampleBase.cs ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs ├── Resources │ ├── AboutResources.txt │ ├── drawable-hdpi │ │ ├── ic_arrow_left.png │ │ ├── ic_arrow_right.png │ │ ├── ic_bookmark.png │ │ ├── ic_bookmark_outline.png │ │ ├── ic_logo.png │ │ ├── ic_magnify.png │ │ ├── ic_mail.png │ │ ├── ic_settings.png │ │ ├── ic_view_module.png │ │ └── ic_view_quilt.png │ ├── drawable-mdpi │ │ ├── ic_arrow_left.png │ │ ├── ic_arrow_right.png │ │ ├── ic_bookmark.png │ │ ├── ic_bookmark_outline.png │ │ ├── ic_logo.png │ │ ├── ic_magnify.png │ │ ├── ic_mail.png │ │ ├── ic_settings.png │ │ ├── ic_view_module.png │ │ └── ic_view_quilt.png │ ├── drawable-v26 │ │ ├── ic_launcher.xml │ │ ├── ic_launcher_bg.xml │ │ └── ic_launcher_fg.xml │ ├── drawable-xhdpi │ │ ├── ic_arrow_left.png │ │ ├── ic_arrow_right.png │ │ ├── ic_bookmark.png │ │ ├── ic_bookmark_outline.png │ │ ├── ic_logo.png │ │ ├── ic_magnify.png │ │ ├── ic_mail.png │ │ ├── ic_settings.png │ │ ├── ic_view_module.png │ │ └── ic_view_quilt.png │ ├── drawable-xxhdpi │ │ ├── ic_arrow_left.png │ │ ├── ic_arrow_right.png │ │ ├── ic_bookmark.png │ │ ├── ic_bookmark_outline.png │ │ ├── ic_logo.png │ │ ├── ic_magnify.png │ │ ├── ic_mail.png │ │ ├── ic_settings.png │ │ ├── ic_view_module.png │ │ └── ic_view_quilt.png │ ├── drawable-xxxhdpi │ │ ├── ic_arrow_left.png │ │ ├── ic_arrow_right.png │ │ ├── ic_bookmark.png │ │ ├── ic_bookmark_outline.png │ │ ├── ic_magnify.png │ │ ├── ic_mail.png │ │ ├── ic_settings.png │ │ ├── ic_view_module.png │ │ └── ic_view_quilt.png │ ├── drawable │ │ ├── ic_collaborate.xml │ │ ├── ic_logo_padded.xml │ │ ├── ic_open_in_browser.xml │ │ ├── mock_page.jpg │ │ └── pspdf_list_divider_light.xml │ ├── layout │ │ ├── ActivityCustomFragment.axml │ │ ├── Main.axml │ │ └── TryInstantConnect.axml │ ├── menu-xlarge │ │ └── activity_settings.xml │ ├── menu │ │ └── activity_settings.xml │ ├── raw │ │ └── guide.pdf │ ├── values-sw360dp │ │ └── dimens.xml │ ├── values-sw384dp │ │ └── dimens.xml │ ├── values-sw520dp │ │ └── dimens.xml │ ├── values-sw600dp │ │ ├── dimens.xml │ │ └── styles.xml │ ├── values-v19 │ │ └── styles.xml │ ├── values-v21 │ │ └── styles.xml │ ├── values-w820dp │ │ └── dimens.xml │ └── values │ │ ├── Colors.xml │ │ ├── DarkTheme.xml │ │ ├── Dimens.xml │ │ ├── Ids.xml │ │ ├── Strings.xml │ │ └── Styles.xml └── UI │ ├── AndroidUI │ └── FixedDrawerLayout.cs │ ├── MainMenuPage.xaml │ ├── MainMenuPage.xaml.cs │ ├── Models │ └── EnumListItem.cs │ ├── OptionSelectedEventArgs.cs │ ├── Settings.cs │ ├── SettingsPage.xaml │ ├── SettingsPage.xaml.cs │ └── ViewModels │ ├── BaseViewModel.cs │ ├── CatalogExamplesViewModel.cs │ └── SettingsViewModel.cs └── XamarinForms ├── Droid ├── Assets │ └── AboutAssets.txt ├── MainActivity.cs ├── PdfViewerPageRenderer.cs ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs ├── Resources │ ├── AboutResources.txt │ ├── drawable-hdpi │ │ └── icon.png │ ├── drawable-xhdpi │ │ └── icon.png │ ├── drawable-xxhdpi │ │ └── icon.png │ ├── drawable │ │ └── icon.png │ ├── layout │ │ ├── ActivityCustomFragment.axml │ │ ├── Tabbar.axml │ │ └── Toolbar.axml │ └── values │ │ └── styles.xml └── XFSample.Droid.csproj └── XFSample ├── App.xaml ├── App.xaml.cs ├── IPdfService.cs ├── PdfViewerPage.xaml ├── PdfViewerPage.xaml.cs ├── XFSample.csproj ├── XFSamplePage.xaml └── XFSamplePage.xaml.cs /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.userprefs 3 | /bin 4 | *.DS_Store 5 | [Bb]in 6 | [Dd]ebug*/ 7 | [Jj]ars 8 | obj/ 9 | tmp/ 10 | *.g.cs 11 | *.pidb 12 | *.dll 13 | *.mdb 14 | packages/ 15 | *.xam 16 | Resource.designer.cs 17 | *.aar 18 | *.jar 19 | *.zip 20 | tools/ 21 | .vs/ 22 | nuget/pkgs/ -------------------------------------------------------------------------------- /Images/AndroidSimple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PSPDFKit/Xamarin-Android/42958ca665eb5bcfc73d746a966fcee31d714d0d/Images/AndroidSimple.png -------------------------------------------------------------------------------- /Images/Catalog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PSPDFKit/Xamarin-Android/42958ca665eb5bcfc73d746a966fcee31d714d0d/Images/Catalog.png -------------------------------------------------------------------------------- /Images/Instant-desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PSPDFKit/Xamarin-Android/42958ca665eb5bcfc73d746a966fcee31d714d0d/Images/Instant-desktop.png -------------------------------------------------------------------------------- /Images/Instant-device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PSPDFKit/Xamarin-Android/42958ca665eb5bcfc73d746a966fcee31d714d0d/Images/Instant-device.png -------------------------------------------------------------------------------- /Images/Project-setup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PSPDFKit/Xamarin-Android/42958ca665eb5bcfc73d746a966fcee31d714d0d/Images/Project-setup.png -------------------------------------------------------------------------------- /Images/XForms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PSPDFKit/Xamarin-Android/42958ca665eb5bcfc73d746a966fcee31d714d0d/Images/XForms.png -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | This wrapper is licensed with a modified BSD license. 2 | 3 | In plain language: you're allowed to do whatever you wish with 4 | the code, modify, redistribute, embed in your products (free or 5 | commercial), but you must include copyright, terms of usage and 6 | disclaimer as stated in the license. 7 | 8 | You will require a commercial PSPDFKit License to run these examples 9 | in non-demo mode. Please refer to sales@pspdfkit.com for details. 10 | 11 | Copyright (c) 2010-2016, PSPDFKit GmbH. 12 | All rights reserved. 13 | 14 | Redistribution and use in source or binary forms, 15 | with or without modification, are permitted provided 16 | that the following conditions are met: 17 | 18 | - Redistributions of source code must retain the above copyright 19 | notice, this list of conditions and the following disclaimer. 20 | 21 | - Redistributions in binary form must reproduce the above copyright 22 | notice, this list of conditions and the following disclaimer in the 23 | documentation and/or other materials provided with the 24 | distribution. 25 | 26 | - Redistributions of PSPDFKit Samples must include attribution to 27 | PSPDFKit, either in documentation or other appropriate media. 28 | 29 | - Neither the name of the PSPDFKit, PSPDFKit GmbH, nor its developers 30 | may be used to endorse or promote products derived from 31 | this software without specific prior written permission. 32 | 33 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 34 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 35 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 36 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 37 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 38 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 39 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 40 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 41 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 42 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 43 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /PSPDFKit.Android.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PSPDFKit.Android", "PSPDFKit.Android\PSPDFKit.Android.csproj", "{B87BA6DF-8454-41AE-811C-B9D7B7353E5D}" 5 | EndProject 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AndroidSample", "samples\AndroidSample\AndroidSample\AndroidSample.csproj", "{1C96E840-A7C0-44FE-85EA-87E666BD7C79}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{0ADD0252-D44F-435B-AEA5-688F478700EF}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "XamarinForms", "XamarinForms", "{C439B234-6654-4A91-A81C-220DEBD37705}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XFSample.Droid", "samples\XamarinForms\Droid\XFSample.Droid.csproj", "{D9B389E9-6FD5-4BBA-A4D1-724A99A30305}" 13 | EndProject 14 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XFSample", "samples\XamarinForms\XFSample\XFSample.csproj", "{240B3D3D-3F8F-4E44-85A5-0E15979791C3}" 15 | EndProject 16 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PSPDFCatalog", "PSPDFCatalog", "{EB25EAE2-596A-4166-920A-9A2666698A00}" 17 | EndProject 18 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PSPDFCatalog", "samples\PSPDFCatalog\PSPDFCatalog.csproj", "{ED077F75-3EED-4638-B609-60BF5AD6D475}" 19 | EndProject 20 | Global 21 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 22 | Debug|Any CPU = Debug|Any CPU 23 | Release|Any CPU = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 26 | {1C96E840-A7C0-44FE-85EA-87E666BD7C79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {1C96E840-A7C0-44FE-85EA-87E666BD7C79}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {1C96E840-A7C0-44FE-85EA-87E666BD7C79}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {1C96E840-A7C0-44FE-85EA-87E666BD7C79}.Release|Any CPU.Build.0 = Release|Any CPU 30 | {B87BA6DF-8454-41AE-811C-B9D7B7353E5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 31 | {B87BA6DF-8454-41AE-811C-B9D7B7353E5D}.Debug|Any CPU.Build.0 = Debug|Any CPU 32 | {B87BA6DF-8454-41AE-811C-B9D7B7353E5D}.Release|Any CPU.ActiveCfg = Release|Any CPU 33 | {B87BA6DF-8454-41AE-811C-B9D7B7353E5D}.Release|Any CPU.Build.0 = Release|Any CPU 34 | {D9B389E9-6FD5-4BBA-A4D1-724A99A30305}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 35 | {D9B389E9-6FD5-4BBA-A4D1-724A99A30305}.Debug|Any CPU.Build.0 = Debug|Any CPU 36 | {D9B389E9-6FD5-4BBA-A4D1-724A99A30305}.Release|Any CPU.ActiveCfg = Release|Any CPU 37 | {D9B389E9-6FD5-4BBA-A4D1-724A99A30305}.Release|Any CPU.Build.0 = Release|Any CPU 38 | {240B3D3D-3F8F-4E44-85A5-0E15979791C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 39 | {240B3D3D-3F8F-4E44-85A5-0E15979791C3}.Debug|Any CPU.Build.0 = Debug|Any CPU 40 | {240B3D3D-3F8F-4E44-85A5-0E15979791C3}.Release|Any CPU.ActiveCfg = Release|Any CPU 41 | {240B3D3D-3F8F-4E44-85A5-0E15979791C3}.Release|Any CPU.Build.0 = Release|Any CPU 42 | {ED077F75-3EED-4638-B609-60BF5AD6D475}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 43 | {ED077F75-3EED-4638-B609-60BF5AD6D475}.Debug|Any CPU.Build.0 = Debug|Any CPU 44 | {ED077F75-3EED-4638-B609-60BF5AD6D475}.Release|Any CPU.ActiveCfg = Release|Any CPU 45 | {ED077F75-3EED-4638-B609-60BF5AD6D475}.Release|Any CPU.Build.0 = Release|Any CPU 46 | EndGlobalSection 47 | GlobalSection(NestedProjects) = preSolution 48 | {1C96E840-A7C0-44FE-85EA-87E666BD7C79} = {0ADD0252-D44F-435B-AEA5-688F478700EF} 49 | {C439B234-6654-4A91-A81C-220DEBD37705} = {0ADD0252-D44F-435B-AEA5-688F478700EF} 50 | {D9B389E9-6FD5-4BBA-A4D1-724A99A30305} = {C439B234-6654-4A91-A81C-220DEBD37705} 51 | {240B3D3D-3F8F-4E44-85A5-0E15979791C3} = {C439B234-6654-4A91-A81C-220DEBD37705} 52 | {EB25EAE2-596A-4166-920A-9A2666698A00} = {0ADD0252-D44F-435B-AEA5-688F478700EF} 53 | {ED077F75-3EED-4638-B609-60BF5AD6D475} = {EB25EAE2-596A-4166-920A-9A2666698A00} 54 | EndGlobalSection 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /PSPDFKit.Android/Additions/AboutAdditions.txt: -------------------------------------------------------------------------------- 1 | Additions allow you to add arbitrary C# to the generated classes 2 | before they are compiled. This can be helpful for providing convenience 3 | methods or adding pure C# classes. 4 | 5 | == Adding Methods to Generated Classes == 6 | 7 | Let's say the library being bound has a Rectangle class with a constructor 8 | that takes an x and y position, and a width and length size. It will look like 9 | this: 10 | 11 | public partial class Rectangle 12 | { 13 | public Rectangle (int x, int y, int width, int height) 14 | { 15 | // JNI bindings 16 | } 17 | } 18 | 19 | Imagine we want to add a constructor to this class that takes a Point and 20 | Size structure instead of 4 ints. We can add a new file called Rectangle.cs 21 | with a partial class containing our new method: 22 | 23 | public partial class Rectangle 24 | { 25 | public Rectangle (Point location, Size size) : 26 | this (location.X, location.Y, size.Width, size.Height) 27 | { 28 | } 29 | } 30 | 31 | At compile time, the additions class will be added to the generated class 32 | and the final assembly will a Rectangle class with both constructors. 33 | 34 | 35 | == Adding C# Classes == 36 | 37 | Another thing that can be done is adding fully C# managed classes to the 38 | generated library. In the above example, let's assume that there isn't a 39 | Point class available in Java or our library. The one we create doesn't need 40 | to interact with Java, so we'll create it like a normal class in C#. 41 | 42 | By adding a Point.cs file with this class, it will end up in the binding library: 43 | 44 | public class Point 45 | { 46 | public int X { get; set; } 47 | public int Y { get; set; } 48 | } 49 | -------------------------------------------------------------------------------- /PSPDFKit.Android/Additions/AnnotationCreationToolbar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Runtime; 3 | namespace PSPDFKit.UI.Toolbar { 4 | public partial class AnnotationCreationToolbar { 5 | public override void BindController (Java.Lang.Object obj) 6 | { 7 | BindController (obj.JavaCast()); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /PSPDFKit.Android/Additions/AnnotationEditingToolbar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Runtime; 3 | namespace PSPDFKit.UI.Toolbar { 4 | public partial class AnnotationEditingToolbar { 5 | public override void BindController (Java.Lang.Object obj) 6 | { 7 | BindController (obj.JavaCast ()); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /PSPDFKit.Android/Additions/BaseRectsAnnotation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Android.Runtime; 4 | using Java.Interop; 5 | 6 | namespace PSPDFKit.Annotations { 7 | public partial class BaseRectsAnnotation { 8 | // Metadata.xml XPath constructor reference: path="/api/package[@name='com.pspdfkit.annotations']/class[@name='BaseRectsAnnotation']/constructor[@name='BaseRectsAnnotation' and count(parameter)=0]" 9 | [Register (".ctor", "()V", "")] 10 | public unsafe BaseRectsAnnotation () 11 | : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) 12 | { 13 | const string __id = "()V"; 14 | 15 | if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) 16 | return; 17 | 18 | try { 19 | var __r = _members.InstanceMethods.StartCreateInstance (__id, ((object) this).GetType (), null); 20 | SetHandle (__r.Handle, JniHandleOwnership.TransferLocalRef); 21 | _members.InstanceMethods.FinishCreateInstance (__id, this, null); 22 | } 23 | finally { 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /PSPDFKit.Android/Additions/DocumentEditingToolbar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Runtime; 3 | namespace PSPDFKit.UI.Toolbar { 4 | public partial class DocumentEditingToolbar { 5 | public override void BindController (Java.Lang.Object obj) 6 | { 7 | BindController (obj.JavaCast ()); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /PSPDFKit.Android/Additions/InstantPdfActivity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Runtime; 3 | using PSPDFKit.UI; 4 | using PSPDFKit.Instant; 5 | 6 | namespace PSPDFKit.Instant { 7 | public partial class InstantPdfActivity : PdfActivity { 8 | 9 | public InstantPdfDocument GetInstantDocument () => Document.JavaCast (); 10 | public InstantPdfFragment GetInstantPdfFragment () => PdfFragment.JavaCast (); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /PSPDFKit.Android/Additions/RedactionAnnotation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Android.Runtime; 4 | using Java.Interop; 5 | 6 | namespace PSPDFKit.Annotations { 7 | public partial class RedactionAnnotation { 8 | 9 | // Metadata.xml XPath constructor reference: path="/api/package[@name='com.pspdfkit.annotations']/class[@name='RedactionAnnotation']/constructor[@name='RedactionAnnotation' and count(parameter)=0]" 10 | [Register (".ctor", "()V", "")] 11 | public unsafe RedactionAnnotation () 12 | : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) 13 | { 14 | const string __id = "()V"; 15 | 16 | if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) 17 | return; 18 | 19 | try { 20 | var __r = _members.InstanceMethods.StartCreateInstance (__id, ((object) this).GetType (), null); 21 | SetHandle (__r.Handle, JniHandleOwnership.TransferLocalRef); 22 | _members.InstanceMethods.FinishCreateInstance (__id, this, null); 23 | } 24 | finally { 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /PSPDFKit.Android/Additions/TextSelectionToolbar.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Runtime; 3 | namespace PSPDFKit.UI.Toolbar { 4 | public partial class TextSelectionToolbar { 5 | public override void BindController (Java.Lang.Object obj) 6 | { 7 | BindController (obj.JavaCast ()); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /PSPDFKit.Android/Jars/AboutJars.txt: -------------------------------------------------------------------------------- 1 | This directory is for Android .jars. 2 | 3 | There are 4 types of jars that are supported: 4 | 5 | == Input Jar and Embedded Jar == 6 | 7 | This is the jar that bindings should be generated for. 8 | 9 | For example, if you were binding the Google Maps library, this would 10 | be Google's "maps.jar". 11 | 12 | The difference between EmbeddedJar and InputJar is, EmbeddedJar is to be 13 | embedded in the resulting dll as EmbeddedResource, while InputJar is not. 14 | There are couple of reasons you wouldn't like to embed the target jar 15 | in your dll (the ones that could be internally loaded by 16 | feature e.g. maps.jar, or you cannot embed jars that are under some 17 | proprietary license). 18 | 19 | Set the build action for these jars in the properties page to "InputJar". 20 | 21 | 22 | == Reference Jar and Embedded Reference Jar == 23 | 24 | These are jars that are referenced by the input jar. C# bindings will 25 | not be created for these jars. These jars will be used to resolve 26 | types used by the input jar. 27 | 28 | NOTE: Do not add "android.jar" as a reference jar. It will be added automatically 29 | based on the Target Framework selected. 30 | 31 | Set the build action for these jars in the properties page to "ReferenceJar". 32 | 33 | "EmbeddedJar" works like "ReferenceJar", but like "EmbeddedJar", it is 34 | embedded in your dll. But at application build time, they are not included 35 | in the final apk, like ReferenceJar files. 36 | 37 | 38 | -------------------------------------------------------------------------------- /PSPDFKit.Android/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using Android; 4 | using Android.App; 5 | 6 | // Information about this assembly is defined by the following attributes. 7 | // Change them to the values specific to your project. 8 | 9 | [assembly: AssemblyTitle ("PSPDFKit.Android")] 10 | [assembly: AssemblyDescription ("")] 11 | [assembly: AssemblyConfiguration ("")] 12 | [assembly: AssemblyCompany ("PSPDFKit GmbH.")] 13 | [assembly: AssemblyProduct ("")] 14 | [assembly: AssemblyCopyright ("PSPDFKit GmbH.")] 15 | [assembly: AssemblyTrademark ("")] 16 | [assembly: AssemblyCulture ("")] 17 | 18 | // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". 19 | // The form "{Major}.{Minor}.*" will automatically update the build and revision, 20 | // and "{Major}.{Minor}.{Build}.*" will update just the revision. 21 | 22 | [assembly: AssemblyVersion ("8.7.3")] 23 | [assembly: LinkerSafe] 24 | 25 | // The following attributes are used to specify the signing key for the assembly, 26 | // if desired. See the Mono documentation for more information about signing. 27 | 28 | //[assembly: AssemblyDelaySign(false)] 29 | //[assembly: AssemblyKeyFile("")] 30 | -------------------------------------------------------------------------------- /PSPDFKit.Android/Transforms/EnumFields.xml: -------------------------------------------------------------------------------- 1 |  2 | 18 | 19 | -------------------------------------------------------------------------------- /PSPDFKit.Android/Transforms/EnumMethods.xml: -------------------------------------------------------------------------------- 1 |  2 | 18 | 19 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ########################################################################## 4 | # This is the Cake bootstrapper script for Linux and OS X. 5 | # This file was downloaded from https://github.com/cake-build/resources 6 | # Feel free to change this file to fit your needs. 7 | ########################################################################## 8 | 9 | # Define directories. 10 | SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 11 | TOOLS_DIR=$SCRIPT_DIR/tools 12 | ADDINS_DIR=$TOOLS_DIR/Addins 13 | MODULES_DIR=$TOOLS_DIR/Modules 14 | NUGET_EXE=$TOOLS_DIR/nuget.exe 15 | CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe 16 | PACKAGES_CONFIG=$TOOLS_DIR/packages.config 17 | PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum 18 | ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config 19 | MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config 20 | 21 | # Define md5sum or md5 depending on Linux/OSX 22 | MD5_EXE= 23 | if [[ "$(uname -s)" == "Darwin" ]]; then 24 | MD5_EXE="md5 -r" 25 | else 26 | MD5_EXE="md5sum" 27 | fi 28 | 29 | # Define default arguments. 30 | SCRIPT="build.cake" 31 | CAKE_ARGUMENTS=() 32 | 33 | # Parse arguments. 34 | for i in "$@"; do 35 | case $1 in 36 | -s|--script) SCRIPT="$2"; shift ;; 37 | --) shift; CAKE_ARGUMENTS+=("$@"); break ;; 38 | *) CAKE_ARGUMENTS+=("$1") ;; 39 | esac 40 | shift 41 | done 42 | 43 | # Make sure the tools folder exist. 44 | if [ ! -d "$TOOLS_DIR" ]; then 45 | mkdir "$TOOLS_DIR" 46 | fi 47 | 48 | # Make sure that packages.config exist. 49 | if [ ! -f "$TOOLS_DIR/packages.config" ]; then 50 | echo "Downloading packages.config..." 51 | curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages 52 | if [ $? -ne 0 ]; then 53 | echo "An error occurred while downloading packages.config." 54 | exit 1 55 | fi 56 | fi 57 | 58 | # Download NuGet if it does not exist. 59 | if [ ! -f "$NUGET_EXE" ]; then 60 | echo "Downloading NuGet..." 61 | curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe 62 | if [ $? -ne 0 ]; then 63 | echo "An error occurred while downloading nuget.exe." 64 | exit 1 65 | fi 66 | fi 67 | 68 | # Restore tools from NuGet. 69 | pushd "$TOOLS_DIR" >/dev/null 70 | if [ ! -f "$PACKAGES_CONFIG_MD5" ] || [ "$( cat "$PACKAGES_CONFIG_MD5" | sed 's/\r$//' )" != "$( $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' )" ]; then 71 | find . -type d ! -name . ! -name 'Cake.Bakery' | xargs rm -rf 72 | fi 73 | 74 | mono "$NUGET_EXE" install -ExcludeVersion 75 | if [ $? -ne 0 ]; then 76 | echo "Could not restore NuGet tools." 77 | exit 1 78 | fi 79 | 80 | $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5" 81 | 82 | popd >/dev/null 83 | 84 | # Restore addins from NuGet. 85 | if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then 86 | pushd "$ADDINS_DIR" >/dev/null 87 | 88 | mono "$NUGET_EXE" install -ExcludeVersion 89 | if [ $? -ne 0 ]; then 90 | echo "Could not restore NuGet addins." 91 | exit 1 92 | fi 93 | 94 | popd >/dev/null 95 | fi 96 | 97 | # Restore modules from NuGet. 98 | if [ -f "$MODULES_PACKAGES_CONFIG" ]; then 99 | pushd "$MODULES_DIR" >/dev/null 100 | 101 | mono "$NUGET_EXE" install -ExcludeVersion 102 | if [ $? -ne 0 ]; then 103 | echo "Could not restore NuGet modules." 104 | exit 1 105 | fi 106 | 107 | popd >/dev/null 108 | fi 109 | 110 | # Make sure that Cake has been installed. 111 | if [ ! -f "$CAKE_EXE" ]; then 112 | echo "Could not find Cake.exe at '$CAKE_EXE'." 113 | exit 1 114 | fi 115 | 116 | # Start Cake 117 | exec mono "$CAKE_EXE" $SCRIPT "${CAKE_ARGUMENTS[@]}" -------------------------------------------------------------------------------- /ci/pipelines/release.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | - label: 'Build Nuget Packages' 3 | command: '( ./build.sh --Target=Nuget )' 4 | agents: 5 | macos: true 6 | 7 | - wait 8 | 9 | - block: ':rocket: Release' 10 | 11 | - label: 'Upload Nuget Packages' 12 | command: '( ./build.sh --Target=Nuget-Push)' 13 | agents: 14 | macos: true 15 | -------------------------------------------------------------------------------- /nuget/PSPDFKit.Android.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | --pg-conf "$(MSBuildThisFileDirectory)..\..\proguard\pspdfkit-proguard.cfg" 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /nuget/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PSPDFKit/Xamarin-Android/42958ca665eb5bcfc73d746a966fcee31d714d0d/nuget/icon.png -------------------------------------------------------------------------------- /nuget/pspdfkit-android.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PSPDFKit.Android 5 | $version$ 6 | PSPDFKit for Xamarin.Android 7 | Nutrient 8 | Nutrient 9 | Copyright 2010-2021 10 | LICENSE.md 11 | https://www.nutrient.io/ 12 | 13 | images\icon.png 14 | false 15 | 16 | The leading framework for displaying, annotating and editing PDFs on iOS, Android, Windows, Electron and the Web. 17 | 18 | The PSPDFKit Xamarin SDK is being sunset and replaced by Nutrient .NET for Android (formally PSPDFKit .NET for Android). All Xamarin SDK licenses will remain valid and fully supported until 1 December 2025, or until your license expires, whichever occurs later. Interested in transitioning to another Nutrient product? Contact us and we’ll be happy to help. 19 | 20 | 21 | For changelog go to: https://pspdfkit.com/changelog/android/ 22 | 23 | A high-performance viewer, extensive annotation and document editing tools, digital signatures, and more. All engineered for the best possible user and developer experience. PSPDFKit — the Android PDF SDK made for you. 24 | pdf, pdf document, pdf document view, pdf sdk, pdf annotation, edit pdf, display pdf, display pdf, xamarin, android 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /nuget/readme.txt: -------------------------------------------------------------------------------- 1 | PSPDFKit SDK for Xamarin 2 | 3 | The PSPDFKit SDK is the leading framework for displaying, annotating and editing PDFs on iOS, macOS, Android, Windows, Electron and the Web. 4 | 5 | PSPDFKit Instant adds real-time collaboration features to seamlessly share, edit, and annotate PDF documents. 6 | 7 | 8 | ## Additional Required Setup (Please Read!) 9 | 10 | You can try PSPDFKit in a few simple steps and get the library up and running in your app with little to no effort. 11 | 12 | 1. If you are a PSPDFKit customer, get the license key from your [customer portal](https://customers.pspdfkit.com/customers/sign_in). 13 | 14 | 2. Set your license key inside your MainActivity.cs in between the using statements and the namespace declaration using an assembly attribute. 15 | Setting the license is not needed if you are evaluating PSPDFKit. 16 | 17 | using System; 18 | using PSPDFKit; 19 | 20 | [assembly: MetaData ( 21 | name: "pspdfkit_license_key", 22 | Value = "YOUR_LICENSE_KEY_GOES_HERE" 23 | )] 24 | 25 | namespace YourAwesomeApp { ... } 26 | 27 | 3. Now you can start using the SDK. 28 | 29 | 30 | ## Examples 31 | 32 | You can find several example projects in https://github.com/PSPDFKit/Xamarin-Android, including a catalog and Xamarin.Forms. 33 | 34 | Visit https://pspdfkit.com/guides/ios/current/other-languages/xamarin/ for more information. 35 | -------------------------------------------------------------------------------- /samples/AndroidSample/AndroidSample.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AndroidSample", "AndroidSample\AndroidSample.csproj", "{1C96E840-A7C0-44FE-85EA-87E666BD7C79}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Any CPU = Debug|Any CPU 9 | Release|Any CPU = Release|Any CPU 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {1C96E840-A7C0-44FE-85EA-87E666BD7C79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 13 | {1C96E840-A7C0-44FE-85EA-87E666BD7C79}.Debug|Any CPU.Build.0 = Debug|Any CPU 14 | {1C96E840-A7C0-44FE-85EA-87E666BD7C79}.Release|Any CPU.ActiveCfg = Release|Any CPU 15 | {1C96E840-A7C0-44FE-85EA-87E666BD7C79}.Release|Any CPU.Build.0 = Release|Any CPU 16 | EndGlobalSection 17 | EndGlobal 18 | -------------------------------------------------------------------------------- /samples/AndroidSample/AndroidSample/AndroidSample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 9 | {1C96E840-A7C0-44FE-85EA-87E666BD7C79} 10 | Library 11 | AndroidSample 12 | Assets 13 | Resources 14 | Resource 15 | Resources\Resource.designer.cs 16 | True 17 | AndroidSample 18 | Properties\AndroidManifest.xml 19 | v13.0 20 | d8 21 | true 22 | PackageReference 23 | 24 | 25 | true 26 | full 27 | false 28 | bin\Debug 29 | DEBUG; 30 | prompt 31 | 4 32 | None 33 | false 34 | arm64-v8a;x86;x86_64;armeabi-v7a 35 | --pg-conf "$(MSBuildProjectDirectory)\pspdfkit-proguard.cfg" 36 | true 37 | 38 | 39 | full 40 | true 41 | bin\Release 42 | prompt 43 | 4 44 | false 45 | false 46 | armeabi-v7a;x86;arm64-v8a;x86_64 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | {B87BA6DF-8454-41AE-811C-B9D7B7353E5D} 88 | PSPDFKit.Android 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | -------------------------------------------------------------------------------- /samples/AndroidSample/AndroidSample/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "AndroidAsset". 3 | 4 | These files will be deployed with your package and will be accessible using Android's 5 | AssetManager, like this: 6 | 7 | public class ReadAsset : Activity 8 | { 9 | protected override void OnCreate (Bundle bundle) 10 | { 11 | base.OnCreate (bundle); 12 | 13 | InputStream input = Assets.Open ("my_asset.txt"); 14 | } 15 | } 16 | 17 | Additionally, some Android functions will automatically load asset files: 18 | 19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); 20 | -------------------------------------------------------------------------------- /samples/AndroidSample/AndroidSample/Assets/demo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PSPDFKit/Xamarin-Android/42958ca665eb5bcfc73d746a966fcee31d714d0d/samples/AndroidSample/AndroidSample/Assets/demo.pdf -------------------------------------------------------------------------------- /samples/AndroidSample/AndroidSample/DocumentHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Globalization; 3 | using System.IO; 4 | using System.Threading.Tasks; 5 | using Android; 6 | using Android.App; 7 | using Android.Content; 8 | using Android.Content.PM; 9 | using Android.OS; 10 | using AndroidX.Core.App; 11 | using AndroidX.Core.Content; 12 | 13 | namespace SampleTools { 14 | public static partial class Utils { 15 | public static readonly int BufferSize = 8192; 16 | 17 | public static Android.Net.Uri ExtractAsset (Context ctx, string assetName) 18 | { 19 | var docPath = Path.Combine (ctx.GetExternalFilesDir (null).AbsolutePath, assetName); 20 | if (!File.Exists (docPath)) { 21 | using (var br = new BinaryReader (ctx.Assets.Open (assetName))) { 22 | using (var bw = new BinaryWriter (new FileStream (docPath, FileMode.Create))) { 23 | var buffer = new byte[2048]; 24 | var len = 0; 25 | while ((len = br.Read (buffer, 0, buffer.Length)) > 0) { 26 | bw.Write (buffer, 0, len); 27 | } 28 | } 29 | } 30 | } 31 | var file = new Java.IO.File (docPath); 32 | return Android.Net.Uri.FromFile (file); 33 | } 34 | 35 | public static async Task DownloadDocument (Context ctx, Android.Net.Uri uriToDownload, string saveFilePath, IProgress progessReporter) 36 | { 37 | int receivedBytes = 0; 38 | int totalBytes = 0; 39 | 40 | using (var assetFileDescriptor = ctx.ContentResolver.OpenAssetFileDescriptor (uriToDownload, "r")) 41 | using (var fileOutputStream = new Java.IO.FileOutputStream (saveFilePath)) 42 | using (var inputStream = assetFileDescriptor.CreateInputStream ()) { 43 | var buffer = new byte [BufferSize]; 44 | totalBytes = (int)assetFileDescriptor.Length; 45 | 46 | for (;;) { 47 | var bytesRead = await inputStream.ReadAsync (buffer, 0, buffer.Length); 48 | if (bytesRead == 0) { 49 | await Task.Yield(); 50 | break; 51 | } 52 | await fileOutputStream.WriteAsync (buffer, 0, buffer.Length); 53 | 54 | receivedBytes += bytesRead; 55 | if (progessReporter != null) { 56 | var args = new DownloadBytesProgress (uriToDownload.ToString (), saveFilePath, receivedBytes, totalBytes); 57 | progessReporter.Report(args); 58 | } 59 | } 60 | inputStream.Close (); 61 | fileOutputStream.Close (); 62 | } 63 | var file = new Java.IO.File (saveFilePath); 64 | var docUri = Android.Net.Uri.FromFile (file); 65 | return docUri; 66 | } 67 | 68 | public static string ToTitleCase (this string s, bool replaceUnderscore = false, string removeStr = null) 69 | { 70 | var ret = s; 71 | 72 | if (removeStr != null) 73 | ret = ret.Replace (removeStr, string.Empty); 74 | 75 | if (replaceUnderscore) 76 | ret = ret.Replace ("_", " "); 77 | 78 | return CultureInfo.CurrentCulture.TextInfo.ToTitleCase (ret.ToLower ()); 79 | } 80 | 81 | public static bool RequestExternalStorageRwPermission (Activity activity, int requestCode) 82 | { 83 | // On Android 6.0+ we ask for SD card access permission. 84 | // Since documents can be annotated we ask for write permission as well. 85 | if (Build.VERSION.SdkInt >= BuildVersionCodes.M) { 86 | if (ContextCompat.CheckSelfPermission (activity, Manifest.Permission.ReadExternalStorage) 87 | != Permission.Granted) { 88 | ActivityCompat.RequestPermissions ( 89 | activity, 90 | new [] { 91 | Manifest.Permission.ReadExternalStorage, Manifest.Permission.WriteExternalStorage 92 | }, 93 | requestCode); 94 | return false; 95 | } 96 | } 97 | return true; 98 | } 99 | } 100 | 101 | public class DownloadBytesProgress 102 | { 103 | public DownloadBytesProgress (string url, string filePath, int bytesReceived, int totalBytes) 104 | { 105 | DownloadUrl = url; 106 | BytesReceived = bytesReceived; 107 | TotalBytes = totalBytes; 108 | SaveFilePath = filePath; 109 | } 110 | 111 | public int TotalBytes { get; private set; } 112 | 113 | public int BytesReceived { get; private set; } 114 | 115 | public float PercentComplete { get { return (float)BytesReceived / TotalBytes; } } 116 | 117 | public string DownloadUrl { get; private set; } 118 | 119 | public string SaveFilePath { get; private set; } 120 | 121 | public bool IsFinished { get { return BytesReceived == TotalBytes; } } 122 | } 123 | } 124 | 125 | -------------------------------------------------------------------------------- /samples/AndroidSample/AndroidSample/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | 4 | using Android; 5 | using Android.App; 6 | using Android.Content; 7 | using Android.Content.PM; 8 | using Android.OS; 9 | using AndroidX.Core.App; 10 | using AndroidX.Core.Content; 11 | using Android.Widget; 12 | 13 | using PSPDFKit; 14 | using PSPDFKit.Configuration.Activity; 15 | using PSPDFKit.Configuration.Page; 16 | using PSPDFKit.UI; 17 | using SampleTools; 18 | using AndroidHUD; 19 | 20 | // This will add your license key into AndroidManifest.xml at build time. For more info on how this Attribute works see: 21 | // https://developer.xamarin.com/guides/android/advanced_topics/working_with_androidmanifest.xml/ 22 | //[assembly: MetaData ( 23 | // name:"pspdfkit_license_key", 24 | // Value = "LICENSE_KEY_GOES_HERE" 25 | //)] 26 | 27 | namespace AndroidSample { 28 | [Activity (Label = "@string/app_name", MainLauncher = true, Icon = "@drawable/icon", Theme = "@style/AppTheme")] 29 | public class MainActivity : Activity { 30 | 31 | const string sampleDoc = "demo.pdf"; 32 | const int RequestOpenDocument = 1; 33 | 34 | // On Marshmallow+ devices this is used to ask for the necessary write permission. 35 | const int RequestWritePermission = 2; 36 | readonly string [] PermissionsExternalStorage = { 37 | Manifest.Permission.ReadExternalStorage, 38 | Manifest.Permission.WriteExternalStorage 39 | }; 40 | 41 | protected override void OnCreate (Bundle savedInstanceState) 42 | { 43 | base.OnCreate (savedInstanceState); 44 | 45 | // Set our view from the "main" layout resource 46 | SetContentView (Resource.Layout.Main); 47 | 48 | var openDemoDocumentButton = FindViewById