Esempio n. 1
0
        public DVCMenu() : base(UITableViewStyle.Grouped, null)
        {
            Root = new RootElement(PSPDFKitGlobal.VersionString)
            {
                new Section("Start here")
                {
                    new StringElement("PSPDFViewController Playground", () => {
                        var pdfViewer = new PlayGroundViewController(NSUrl.FromFilename(PSPDFKitFile));
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("PSPDFKit Instant", () => {
                        var instantExample = new InstantExampleViewController();
                        NavigationController.PushViewController(instantExample, true);
                    }),
                },
                new Section("Annotations")
                {
                    new StringElement("Annotations From Code", () => {
                        var documenturl = NSUrl.FromFilename(HackerMonthlyFile);
                        var pdfViewer   = new AnnotationsFromCodeViewController(documenturl);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                },
                new Section("Password / Security", "Password is: test123")
                {
                    new StringElement("Password Preset", () => {
                        var document = new PSPDFDocument(NSUrl.FromFilename(ProtectedFile));
                        document.Unlock("test123");
                        var pdfViewer = new PSPDFViewController(document);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Password Not Preset", () => {
                        var document  = new PSPDFDocument(NSUrl.FromFilename(ProtectedFile));
                        var pdfViewer = new PSPDFViewController(document);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Create Password Protected PDF", async() => {
                        var document = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        var status   = PSPDFStatusHUDItem.CreateProgress("Preparing");
                        await status.PushAsync(true);
                        // Create temp file and password
                        var tempPdf  = NSUrl.FromFilename(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".pdf"));
                        var password = "******";

                        // We start a new task so this executes on a separated thread since it is a hevy task and we don't want to block the UI
                        await Task.Factory.StartNew(() => {
                            PSPDFProcessor.GeneratePdf(configuration: new PSPDFProcessorConfiguration(document),
                                                       securityOptions: new PSPDFDocumentSecurityOptions(password, password, PSPDFDocumentSecurityOptions.KeyLengthAutomatic, out var err),
                                                       fileUrl: tempPdf,
                                                       progressHandler: (currentPage, totalPages) => InvokeOnMainThread(() => status.Progress = (nfloat)currentPage / totalPages),
                                                       error: out var error);
                        });
                        InvokeOnMainThread(() => {
                            status.Pop(true, null);
                            var docToShow = new PSPDFDocument(tempPdf);
                            var pdfViewer = new PSPDFViewController(docToShow);
                            NavigationController.PushViewController(pdfViewer, true);
                        });
                    }),
Esempio n. 2
0
        public DVCMenu()
            : base(UITableViewStyle.Grouped, null)
        {
            Root = new RootElement ("PSPDFKit") {
                new Section (PSPDFKitGlobal.VersionString){
                    new StringElement ("PSPDFViewController playground", () => {
                        var pdfViewer = new PlayGroundViewController (NSUrl.FromFilename (HackerMonthlyFile));
                        NavigationController.PushViewController (pdfViewer, true);
                    })
                },
                new Section ("Annotations"){
                    new StringElement ("Annotations From Code", () => {
                        // we use a NSData document here but it'll work even better with a file-based variant.
                        NSError err;
                        var documentData = NSData.FromUrl (NSUrl.FromFilename (HackerMonthlyFile), NSDataReadingOptions.Mapped, out err);
                        var pdfViewer = new AnnotationsFromCodeViewController (documentData);
                        NavigationController.PushViewController (pdfViewer, true);
                    })
                },
                new Section ("Interface"){
                    new StringElement ("Dropbox-like interface", () => {
                        var document = new PSPDFDocument (NSUrl.FromFilename (HackerMonthlyFile));
                        var pdfViewer = new DropboxPDFViewController (document);
                        NavigationController.PushViewController (pdfViewer, true);
                    })
                },
                new Section ("Password / Security", "Password is: test123") {
                    new StringElement ("Password Preset", () => {
                        var document = new PSPDFDocument (NSUrl.FromFilename (ProtectedFile));
                        document.UnlockWithPassword ("test123");
                        var pdfViewer = new PSPDFViewController (document);
                        NavigationController.PushViewController (pdfViewer, true);
                    }),
                    new StringElement ("Password Not Preset", () => {
                        var document = new PSPDFDocument (NSUrl.FromFilename (ProtectedFile));
                        var pdfViewer = new PSPDFViewController (document);
                        NavigationController.PushViewController (pdfViewer, true);
                    }),
                    new StringElement ("Create Password Protected PDF", () => {
                        var document = new PSPDFDocument (NSUrl.FromFilename (HackerMonthlyFile));
                        var status = PSPDFStatusHUDItem.GetProgressItem ("Preparing");
                        status.Push (true);
                        // Create temp file and password
                        var tempPdf = NSUrl.FromFilename (Path.Combine (Path.GetTempPath (), Guid.NewGuid ().ToString () + ".pdf"));
                        var password = new NSString ("test123");

                        // Lets create the dictionary options needed by the PSPDFProcesor
                        // With password protected pages, PSPDFProcessor can only add link annotations.
                        // We use a helper class to access the CGPDFContextKeys used by the dictionary
                        var processorOptions = new NSMutableDictionary ();
                        processorOptions.LowlevelSetObject (password, Helper.CGPDFContextUserPassword);
                        processorOptions.LowlevelSetObject (password, Helper.CGPDFContextOwnerPassword);
                        processorOptions.LowlevelSetObject (NSNumber.FromInt32 (128), Helper.CGPDFContextEncryptionKeyLength);
                        processorOptions.LowlevelSetObject (NSNumber.FromBoolean (true), PSPDFProcessorOptionKeys.AnnotationAsDictionary.Handle);
                        processorOptions.LowlevelSetObject (NSNumber.FromObject (PSPDFAnnotationType.Link), PSPDFProcessorOptionKeys.AnnotationTypes.Handle);

                        // We create the page range we want to include in our pdf
                        var pageRange = new [] { NSIndexSet.FromNSRange (new NSRange (0, (int)document.PageCount)) };
                        // We start a new task so this executes on a separated thread since it is a hevy task and we don't want to block the UI
                        Task.Factory.StartNew (()=> {
                            NSError err;
                            PSPDFProcessor.DefaultProcessor.GeneratePDFFromDocument (document: document,
                                                                                     pageRange: pageRange,
                                                                                     fileURL: tempPdf,
                                                                                     options: (NSDictionary) processorOptions,
                                progressHandler: (currentPage, numberOfProcessedPages, totalPages) => InvokeOnMainThread (()=> status.Progress = ((float)numberOfProcessedPages / (float)totalPages)),
                                                                                     error: out err);
                        }).ContinueWith ((task) => {
                            InvokeOnMainThread (()=> {
                                status.Pop (true);
                                var docToShow = new PSPDFDocument (tempPdf);
                                var pdfViewer = new PSPDFViewController (docToShow);
                                NavigationController.PushViewController (pdfViewer, true);
                            });
                        });
                    }),
                },
                new Section ("Subclassing", "Examples how to subclass PSPDFKit."){
                    new StringElement ("Annotation Link Editor", () => {
                        var document = new PSPDFDocument (NSUrl.FromFilename (HackerMonthlyFile));
                        // Need to cast to solve ambiguity between NSObject and string ctor
                        document.EditableAnnotationTypes = new NSOrderedSet (
                            (NSObject) PSPDFAnnotationString.Link, // Important!!
                            (NSObject) PSPDFAnnotationString.Highlight,
                            (NSObject) PSPDFAnnotationString.Underline,
                            (NSObject) PSPDFAnnotationString.Squiggly,
                            (NSObject) PSPDFAnnotationString.StrikeOut,
                            (NSObject) PSPDFAnnotationString.Note,
                            (NSObject) PSPDFAnnotationString.FreeText,
                            (NSObject) PSPDFAnnotationString.Ink,
                            (NSObject) PSPDFAnnotationString.Square,
                            (NSObject) PSPDFAnnotationString.Circle,
                            (NSObject) PSPDFAnnotationString.Stamp );

                        var pdfViewer = new LinkEditorViewController (document);
                        NavigationController.PushViewController (pdfViewer, true);
                    }),
                    new StringElement ("Capture Bookmarks", () => {
                        var document = new PSPDFDocument (NSUrl.FromFilename (HackerMonthlyFile));
                        document.OverrideClass (new Class (typeof (PSPDFBookmarkParser)), new Class (typeof (CustomBookmarkParser)));
                        var pdfViewer = new PSPDFViewController (document);
                        pdfViewer.RightBarButtonItems = new NSObject[] { pdfViewer.BookmarkButtonItem, pdfViewer.SearchButtonItem, pdfViewer.OutlineButtonItem, pdfViewer.ViewModeButtonItem };
                        NavigationController.PushViewController (pdfViewer, true);
                    }),
                    new StringElement ("Change link background color to red", () => {
                        var document = new PSPDFDocument (NSUrl.FromFilename (HackerMonthlyFile));
                        // Note: You can also globally change the color using:
                        // PSPDFLinkAnnotationView.SetGlobalBorderColor = UIColor.Green;
                        // We don't use this in the example here since it would change the color globally for all examples.
                        var pdfViewer = new PSPDFViewController (document);
                        pdfViewer.OverrideClass (new Class (typeof (PSPDFLinkAnnotationView)), new Class (typeof (CustomLinkAnnotationView)));
                        NavigationController.PushViewController (pdfViewer, true);
                    }),
                    new StringElement ("Custom AnnotationProvider", () => {
                        var document = new PSPDFDocument (NSUrl.FromFilename (HackerMonthlyFile));
                        document.SetDidCreateDocumentProviderBlock ((documentProvider)=> {
                            documentProvider.AnnotationManager.AnnotationProviders = new NSObject[] { new CustomAnnotationProvider ((int)documentProvider.Document.PageCount), documentProvider.AnnotationManager.FileAnnotationProvider };
                        });
                        var pdfViewer = new PSPDFViewController (document);
                        NavigationController.PushViewController (pdfViewer, true);
                    })
                },
            };
        }
Esempio n. 3
0
        public DVCMenu() : base(UITableViewStyle.Grouped, null)
        {
            Root = new RootElement(PSPDFKitGlobal.VersionString)
            {
                new Section("Start here")
                {
                    new StringElement("PSPDFViewController Playground", () => {
                        var pdfViewer = new PlayGroundViewController(NSUrl.FromFilename(PSPDFKitFile));
                        NavigationController.PushViewController(pdfViewer, true);
                    })
                },
                new Section("Annotations")
                {
                    new StringElement("Annotations From Code", () => {
                        // we use a NSData document here but it'll work even better with a file-based variant.
                        NSError err;
                        var documentData = NSData.FromUrl(NSUrl.FromFilename(HackerMonthlyFile), NSDataReadingOptions.Mapped, out err);
                        var pdfViewer    = new AnnotationsFromCodeViewController(documentData);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                },
                new Section("Password / Security", "Password is: test123")
                {
                    new StringElement("Password Preset", () => {
                        var document = new PSPDFDocument(NSUrl.FromFilename(ProtectedFile));
                        document.Unlock("test123");
                        var pdfViewer = new PSPDFViewController(document);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Password Not Preset", () => {
                        var document  = new PSPDFDocument(NSUrl.FromFilename(ProtectedFile));
                        var pdfViewer = new PSPDFViewController(document);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Create Password Protected PDF", async() => {
                        var document = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        var status   = PSPDFStatusHUDItem.GetProgressHud("Preparing");
                        status.Push(true, null);
                        // Create temp file and password
                        var tempPdf  = NSUrl.FromFilename(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".pdf"));
                        var password = "******";

                        // We start a new task so this executes on a separated thread since it is a hevy task and we don't want to block the UI
                        await Task.Factory.StartNew(() => {
                            NSError err;
                            PSPDFProcessor.GeneratePdf(configuration: new PSPDFProcessorConfiguration(document),
                                                       saveOptions: new PSPDFProcessorSaveOptions(password, password, PSPDFProcessorSaveOptions.KeyLengthAutomatic),
                                                       fileUrl: tempPdf,
                                                       progressHandler: (currentPage, totalPages) => InvokeOnMainThread(() => status.Progress = (nfloat)currentPage / totalPages),
                                                       error: out err);
                        });
                        InvokeOnMainThread(() => {
                            status.Pop(true, null);
                            var docToShow = new PSPDFDocument(tempPdf);
                            var pdfViewer = new PSPDFViewController(docToShow);
                            NavigationController.PushViewController(pdfViewer, true);
                        });
                    }),
                },
                new Section("Subclassing", "Examples how to subclass PSPDFKit.")
                {
                    new StringElement("Annotation Link Editor", () => {
                        var document      = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        var editableTypes = new NSSet <NSString> (
                            PSPDFAnnotationString.Link,                             // Important!!
                            PSPDFAnnotationString.Highlight,
                            PSPDFAnnotationString.Underline,
                            PSPDFAnnotationString.Squiggly,
                            PSPDFAnnotationString.StrikeOut,
                            PSPDFAnnotationString.Note,
                            PSPDFAnnotationString.FreeText,
                            PSPDFAnnotationString.Ink,
                            PSPDFAnnotationString.Square,
                            PSPDFAnnotationString.Circle,
                            PSPDFAnnotationString.Stamp);

                        var pdfViewer = new LinkEditorViewController(document, PSPDFConfiguration.FromConfigurationBuilder((builder) => {
                            builder.EditableAnnotationTypes = editableTypes;
                        }));
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Capture Bookmarks", () => {
                        var document = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        document.BookmarkManager.Provider = new IPSPDFBookmarkProvider [] { new CustomBookmarkProvider() };
                        var pdfViewer = new PSPDFViewController(document);
                        pdfViewer.NavigationItem.RightBarButtonItems = new [] { pdfViewer.SearchButtonItem, pdfViewer.OutlineButtonItem, pdfViewer.BookmarkButtonItem };
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Change link background color to red", () => {
                        var document  = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        var pdfViewer = new PSPDFViewController(document, PSPDFConfiguration.FromConfigurationBuilder((builder) => {
                            builder.OverrideClass(typeof(PSPDFLinkAnnotationView), typeof(CustomLinkAnnotationView));
                        }));
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Custom AnnotationProvider", () => {
                        var document = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        document.DidCreateDocumentProviderHandler = (documentProvider => {
                            documentProvider.AnnotationManager.AnnotationProviders = new IPSPDFAnnotationProvider[] { new CustomAnnotationProvider(document), documentProvider.AnnotationManager.FileAnnotationProvider };
                        });
                        var pdfViewer = new PSPDFViewController(document);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Custom Document", () => {
                        var pdfViewer      = new PSPDFViewController();
                        var document       = new CustomPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        pdfViewer.Document = document;
                        NavigationController.PushViewController(pdfViewer, true);
                    })
                },
                new Section("PSPDFViewController Customization")
                {
                    new StringElement("Custom Google Text Selection Menu", () => {
                        var pdfViewer = new PSCustomTextSelectionMenuController {
                            Document = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile))
                        };
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Simple Drawing Button", () => {
                        var document = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile))
                        {
                            AnnotationSaveMode = PSPDFAnnotationSaveMode.Disabled
                        };
                        var pdfViewer = new PSCSimpleDrawingPDFViewController(document);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Stylus Support", () => {
                        // TODO: Stylus Support
                        // Uncomment all the needed driver lines once you added the corresponding Dll's.
                        //
                        // Please visit PSPDFKit support page for more information
                        // https://pspdfkit.com/guides/ios/current/other-languages/xamarin-stylus-support/
                        //
                        PSPDFKitGlobal.SharedInstance.StylusManager.AvailableDriverClasses = new NSOrderedSet <Class> (
                            //new Class (typeof (PSPDFKit.iOS.StylusSupport.PSPDFFiftyThreeStylusDriver)),
                            //new Class (typeof (PSPDFKit.iOS.StylusSupport.PSPDFJotTouchStylusDriver)),
                            //new Class (typeof (PSPDFKit.iOS.StylusSupport.PSPDFWacomStylusDriver)),
                            //new Class (typeof (PSPDFKit.iOS.StylusSupport.PSPDFPogoStylusDriver))
                            );

                        var document  = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        var pdfViewer = new PSPDFViewController(document, PSPDFConfiguration.FromConfigurationBuilder((builder) => {
                            builder.OverrideClass(typeof(PSPDFAnnotationToolbar), typeof(PSCStylusEnabledAnnotationToolbar));
                        }));
                        NavigationController.PushViewController(pdfViewer, true);
                    })
                },
            };
        }
Esempio n. 4
0
        public DVCMenu() : base(UITableViewStyle.Grouped, null)
        {
            Root = new RootElement(PSPDFKitGlobal.SharedInstance.Version)
            {
                new Section("Different cell size")
                {
                    new StringElement("Hager document", () => {
                        var document  = new PSPDFDocument(NSUrl.FromFilename(PdfHagerFile));
                        var pdfViewer = new DifferentCellSizeViewController(document);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("PsPdfKit document", () => {
                        var document  = new PSPDFDocument(NSUrl.FromFilename(PSPDFKitFile));
                        var pdfViewer = new DifferentCellSizeViewController(document);
                        NavigationController.PushViewController(pdfViewer, true);
                    })
                },

                new Section("Page selection from Thumbnail View Controller")
                {
                    new StringElement("Custom delegate", () => {
                        var document  = new PSPDFDocument(NSUrl.FromFilename(PdfHagerFile));
                        var pdfViewer = new ThumbnailSelectionIssueViewController(document);
                        NavigationController.PushViewController(pdfViewer, true);
                    })
                },

                new Section("Start here")
                {
                    new StringElement("PSPDFViewController Playground", () => {
                        var pdfViewer = new PlayGroundViewController(NSUrl.FromFilename(PSPDFKitFile));
                        NavigationController.PushViewController(pdfViewer, true);
                    })
                },
                new Section("Annotations")
                {
                    new StringElement("Annotations From Code", () => {
                        // we use a NSData document here but it'll work even better with a file-based variant.
                        NSError err;
                        var documentData = NSData.FromUrl(NSUrl.FromFilename(HackerMonthlyFile), NSDataReadingOptions.Mapped, out err);
                        var pdfViewer    = new AnnotationsFromCodeViewController(documentData);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                },
                new Section("Password / Security", "Password is: test123")
                {
                    new StringElement("Password Preset", () => {
                        var document = new PSPDFDocument(NSUrl.FromFilename(ProtectedFile));
                        document.Unlock("test123");
                        var pdfViewer = new PSPDFViewController(document);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Password Not Preset", () => {
                        var document  = new PSPDFDocument(NSUrl.FromFilename(ProtectedFile));
                        var pdfViewer = new PSPDFViewController(document);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Create Password Protected PDF", async() => {
                        var document = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        var status   = PSPDFStatusHUDItem.GetProgressHud("Preparing");
                        status.Push(true, null);
                        // Create temp file and password
                        var tempPdf  = NSUrl.FromFilename(Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".pdf"));
                        var password = "******";

                        // We start a new task so this executes on a separated thread since it is a hevy task and we don't want to block the UI
                        await Task.Factory.StartNew(() => {
                            NSError err;
                            PSPDFProcessor.GeneratePdf(configuration: new PSPDFProcessorConfiguration(document),
                                                       saveOptions: new PSPDFProcessorSaveOptions(password, password, NSNumber.FromInt32(128)),
                                                       fileUrl: tempPdf,
                                                       progressHandler: (currentPage, totalPages) => InvokeOnMainThread(() => status.Progress = (nfloat)currentPage / totalPages),
                                                       error: out err);
                        });
                        InvokeOnMainThread(() => {
                            status.Pop(true, null);
                            var docToShow = new PSPDFDocument(tempPdf);
                            var pdfViewer = new PSPDFViewController(docToShow);
                            NavigationController.PushViewController(pdfViewer, true);
                        });
                    }),
                },
                new Section("Subclassing", "Examples how to subclass PSPDFKit.")
                {
                    new StringElement("Annotation Link Editor", () => {
                        var document      = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        var editableTypes = new NSSet <NSString> (
                            PSPDFAnnotationString.Link,                             // Important!!
                            PSPDFAnnotationString.Highlight,
                            PSPDFAnnotationString.Underline,
                            PSPDFAnnotationString.Squiggly,
                            PSPDFAnnotationString.StrikeOut,
                            PSPDFAnnotationString.Note,
                            PSPDFAnnotationString.FreeText,
                            PSPDFAnnotationString.Ink,
                            PSPDFAnnotationString.Square,
                            PSPDFAnnotationString.Circle,
                            PSPDFAnnotationString.Stamp);

                        var pdfViewer = new LinkEditorViewController(document, PSPDFConfiguration.FromConfigurationBuilder((builder) => {
                            builder.EditableAnnotationTypes = editableTypes;
                        }));
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Capture Bookmarks", () => {
                        var document = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        document.OverrideClass(new Class(typeof(PSPDFBookmarkParser)), new Class(typeof(CustomBookmarkParser)));
                        var pdfViewer = new PSPDFViewController(document);
                        pdfViewer.NavigationItem.RightBarButtonItems = new [] { pdfViewer.SearchButtonItem, pdfViewer.OutlineButtonItem, pdfViewer.BookmarkButtonItem };
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Change link background color to red", () => {
                        var document = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        // Note: You can also globally change the color using:
                        // PSPDFLinkAnnotationView.SetGlobalBorderColor = UIColor.Green;
                        // We don't use this in the example here since it would change the color globally for all examples.
                        var pdfViewer = new PSPDFViewController(document, PSPDFConfiguration.FromConfigurationBuilder((builder) => {
                            builder.OverrideClass(new Class(typeof(PSPDFLinkAnnotationView)), new Class(typeof(CustomLinkAnnotationView)));
                        }));
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Custom AnnotationProvider", () => {
                        var document = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        document.DidCreateDocumentProviderHandler = (documentProvider => {
                            documentProvider.AnnotationManager.AnnotationProviders = new IPSPDFAnnotationProvider[] { new CustomAnnotationProvider(document), documentProvider.AnnotationManager.FileAnnotationProvider };
                        });
                        var pdfViewer = new PSPDFViewController(document);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Custom Document", () => {
                        var pdfViewer      = new PSPDFViewController();
                        var document       = new CustomPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        pdfViewer.Document = document;
                        NavigationController.PushViewController(pdfViewer, true);
                    })
                },
                new Section("PSPDFViewController Customization")
                {
                    new StringElement("Custom Google Text Selection Menu", () => {
                        var pdfViewer = new PSCustomTextSelectionMenuController {
                            Document = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile))
                        };
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Simple Drawing Button", () => {
                        var document = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile))
                        {
                            AnnotationSaveMode = PSPDFAnnotationSaveMode.Disabled
                        };
                        var pdfViewer = new PSCSimpleDrawingPDFViewController(document);
                        NavigationController.PushViewController(pdfViewer, true);
                    }),
                    new StringElement("Stylus Support", () => {
                        var document  = new PSPDFDocument(NSUrl.FromFilename(HackerMonthlyFile));
                        var pdfViewer = new PSPDFViewController(document, PSPDFConfiguration.FromConfigurationBuilder((builder) => {
                            builder.OverrideClass(new Class(typeof(PSPDFAnnotationToolbar)), new Class(typeof(PSCStylusEnabledAnnotationToolbar)));
                        }));
                        NavigationController.PushViewController(pdfViewer, true);
                    })
                },
            };
        }