コード例 #1
0
		void ShowPdfDocument (Android.Net.Uri docUri)
		{
			// Customize thumbnailBar color defaults
			var thumbnailBarThemeConfiguration = new ThumbnailBarThemeConfiguration.Builder (this)
				.SetBackgroundColor (Android.Graphics.Color.Argb (255, 52, 152, 219))
				.SetThumbnailBorderColor (Android.Graphics.Color.Argb (255, 44, 62, 80))
				.Build ();

			// Show Document using PSPDFKit activity
			var pspdfkitConfiguration = new PSPDFActivityConfiguration.Builder (ApplicationContext, yourLicenseKey)
				.ScrollDirection (PageScrollDirection.Horizontal)
				.ShowPageNumberOverlay ()
				.ShowThumbnailGrid ()
				.ShowThumbnailBar ()
				.ThumbnailBarThemeConfiguration (thumbnailBarThemeConfiguration)
				.Build ();

			if (!PSPDFKitGlobal.IsOpenableUri (this, docUri))
				ShowError ("This document uri cannot be opened \n " + docUri.ToString ());
			else
				PSPDFAppCompatActivity.ShowDocument (this, docUri, pspdfkitConfiguration);
		}
コード例 #2
0
        void ShowPdfDocument(Android.Net.Uri docUri, string filename)
        {
            // Customize thumbnailBar color defaults
            var thumbnailBarThemeConfiguration = new ThumbnailBarThemeConfiguration.Builder (Forms.Context)
                .SetBackgroundColor (Android.Graphics.Color.Argb (255, 52, 152, 219))
                .SetThumbnailBorderColor (Android.Graphics.Color.Argb (255, 44, 62, 80))
                .Build ();

            // Show Document using PSPDFKit activity
            var pspdfkitConfiguration = new PSPDFActivityConfiguration.Builder (Forms.Context, MainActivity.LicenseKey)
                .ScrollDirection (PageScrollDirection.Horizontal)
                .ShowPageNumberOverlay ()
                .ShowThumbnailGrid ()
                .ShowThumbnailBar ()
                .ThumbnailBarThemeConfiguration (thumbnailBarThemeConfiguration)
                .Build ();

            if (!PSPDFKitGlobal.IsOpenableUri (Forms.Context, docUri)) {
                ShowError ("This document uri cannot be opened \n " + docUri.ToString ());
            } else {
                try{
                    PSPDFAppCompatActivity.ShowDocument (Forms.Context, docUri, pspdfkitConfiguration);
                }
                catch(Exception ex){
                    var error = ex.StackTrace;
                }

            }
        }