public override void WillUnloadPageView(PSPDFViewController pdfController, PSPDFPageView pageView) { if (WillUnloadPageViewEvent != null) { WillUnloadPageViewEvent(pageView); } }
public override void DidEndPageZooming(PSPDFViewController pdfController, UIScrollView scrollView, nfloat scale) { if (DidEndPageZoomingEvent != null) { DidEndPageZoomingEvent(scale); } }
public PSPDFMenuItem[] ShouldShowMenuItemsForSelectedText(PSPDFViewController pdfController, PSPDFMenuItem[] menuItems, CGRect rect, string selectedText, CGRect textRect, PSPDFPageView pageView) { // Disable Wikipedia // Be sure to check for PSPDFMenuItem class; there might also be classic UIMenuItems in the array. // Note that for words that are in the iOS dictionary, instead of Wikipedia we show the "Define" menu item with the native dict. // There is also a simpler way to disable wikipedia (See PSPDFTextSelectionMenuAction) var newMenuItems = menuItems.Where((item) => !(item.IsKindOfClass(new Class(typeof(PSPDFMenuItem))) && item.Identifier == "Wikipedia")).ToList(); // Add option to Google for it. newMenuItems.Add(new PSPDFMenuItem("Google", () => { var queryUri = new Uri(string.Format("https://www.google.com/search?q={0}", selectedText)); var nsurl = new NSUrl(queryUri.GetComponents(UriComponents.HttpRequestUrl, UriFormat.UriEscaped)); var browser = new PSPDFWebViewController(nsurl) { Delegate = pdfController, PreferredContentSize = new CGSize(600, 500) }; var browserOptions = NSDictionary <NSString, NSObject> .FromObjectsAndKeys( new NSObject[] { NSValue.FromCGRect(rect), NSNumber.FromBoolean(true), NSNumber.FromBoolean(true) }, new NSObject[] { PSPDFPresentationKeys.RectKey, PSPDFPresentationKeys.InNavigationControllerKey, PSPDFPresentationKeys.CloseButtonKey } ); pdfController.PresentViewController(browser, browserOptions, true, null, null); }, "Google")); return(newMenuItems.ToArray()); }
public override void DidChangeViewMode(PSPDFViewController pdfController, PSPDFViewMode viewMode) { if (DidChangeViewModeEvent != null) { DidChangeViewModeEvent(); } }
public override void DidRenderPageView(PSPDFViewController pdfController, PSPDFPageView pageView) { if (DidRenderPageViewEvent != null) { DidRenderPageViewEvent(pageView); } }
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); }); }),
public override void DidLoadPageView(PSPDFViewController pdfController, PSPDFPageView pageView) { // Fixed in 2.6.4 bindings. Looping subviews no longer crashes. foreach(UIView oSubview in pageView.Subviews) { Console.WriteLine(oSubview.DebugDescription); } }
public override void DidLoadPageView(PSPDFViewController pdfController, PSPDFPageView pageView) { // Fixed in 2.6.4 bindings. Looping subviews no longer crashes. foreach (UIView oSubview in pageView.Subviews) { Console.WriteLine(oSubview.DebugDescription); } }
/// <summary> /// Creates an instance of the PDF viewer. /// </summary> /// <returns> /// The PDF viewer. /// </returns> /// <param name='sFilename'> /// Name of the PDF to open. /// </param> /// <param name='iInitialPage'> /// The initial pae number to go to. /// </param> /// <param name='bAllowsPrinting'> /// True to enable the print menu. /// </param> /// <param name='bAllowsExport'> /// True to allow exporting the document to other apps. /// </param> public static PSPDFViewController CreatePDFViewer(string sFilename, uint iInitialPage, bool bAllowsPrinting, bool bAllowsExport) { // Use PSPDFKit to view PDFs. var document = new PSPDFKitDocument(NSUrl.FromFilename(sFilename), bAllowsExport && bAllowsPrinting, bAllowsExport && bAllowsPrinting); var oClassDic = new NSMutableDictionary(); //oClassDic [new NSString("PSPDFFileAnnotationProvider")] = new NSString("CustomFileAnnnotationsProvider"); oClassDic.LowlevelSetObject(new Class(typeof(CustomFileAnnnotationsProvider)).Handle, new Class(typeof(PSPDFFileAnnotationProvider)).Handle); document.OverrideClassNames = oClassDic; // Read PDF properties from config. PSPDFPageTransition ePageTransition = PSPDFPageTransition.Curl; PSPDFPageMode ePageMode = PSPDFPageMode.Automatic; PSPDFScrollDirection eScrollDirection = PSPDFScrollDirection.Horizontal; var oPdfViewer = new PSPDFViewController(document) { ModalPresentationStyle = MonoTouch.UIKit.UIModalPresentationStyle.FullScreen, ModalTransitionStyle = MonoTouch.UIKit.UIModalTransitionStyle.CoverVertical, LinkAction = PSPDFLinkAction.OpenSafari, PageTransition = ePageTransition, PageMode = ePageMode, ScrollDirection = eScrollDirection, RenderAnnotationTypes = PSPDFAnnotationType.Highlight | PSPDFAnnotationType.Ink | PSPDFAnnotationType.Note | PSPDFAnnotationType.Text | PSPDFAnnotationType.Link, Delegate = new PSPDFKitViewControllerDelegate() }; var oControllerClassDic = new NSMutableDictionary(); oControllerClassDic.LowlevelSetObject(new Class(typeof(CustomNoteAnnotationController)).Handle, new Class(typeof(PSPDFNoteAnnotationController)).Handle); oControllerClassDic.LowlevelSetObject(new Class(typeof(CustomLinkAnnotationView)).Handle, new Class(typeof(PSPDFLinkAnnotationView)).Handle); oPdfViewer.OverrideClassNames = oControllerClassDic; List <PSPDFBarButtonItem> aButtons = new List <PSPDFBarButtonItem>() { oPdfViewer.AnnotationButtonItem, oPdfViewer.BookmarkButtonItem, oPdfViewer.SearchButtonItem, oPdfViewer.OutlineButtonItem }; if (bAllowsPrinting && bAllowsExport) { //aButtons.Add(this.oPdfViewer.EmailButtonItem); aButtons.Add(oPdfViewer.PrintButtonItem); aButtons.Add(oPdfViewer.OpenInButtonItem); } aButtons.Add(oPdfViewer.ViewModeButtonItem); oPdfViewer.RightBarButtonItems = aButtons.ToArray(); aButtons = null; oPdfViewer.SetPageAnimated(iInitialPage, false); return(oPdfViewer); }
public override void DidHideHud(PSPDFViewController pdfController, bool animated) { UIApplication.SharedApplication.SetStatusBarHidden(true, true); if (DidShowHideHudEvent != null) { DidShowHideHudEvent(); } }
public override bool ShouldShowHud(PSPDFViewController pdfController, bool animated) { if (ShouldShowHudEvent != null) { ShouldShowHudEvent(); } return(true); }
/// <summary> /// Creates an instance of the PDF viewer. /// </summary> /// <returns> /// The PDF viewer. /// </returns> /// <param name='sFilename'> /// Name of the PDF to open. /// </param> /// <param name='iInitialPage'> /// The initial pae number to go to. /// </param> /// <param name='bAllowsPrinting'> /// True to enable the print menu. /// </param> /// <param name='bAllowsExport'> /// True to allow exporting the document to other apps. /// </param> public static PSPDFViewController CreatePDFViewer(string sFilename, uint iInitialPage, bool bAllowsPrinting, bool bAllowsExport) { // Use PSPDFKit to view PDFs. var document = new PSPDFKitDocument(NSUrl.FromFilename(sFilename), bAllowsExport && bAllowsPrinting, bAllowsExport && bAllowsPrinting); var oClassDic = new NSMutableDictionary(); //oClassDic [new NSString("PSPDFFileAnnotationProvider")] = new NSString("CustomFileAnnnotationsProvider"); oClassDic.LowlevelSetObject(new Class(typeof(CustomFileAnnnotationsProvider)).Handle, new Class(typeof(PSPDFFileAnnotationProvider)).Handle); document.OverrideClassNames = oClassDic; // Read PDF properties from config. PSPDFPageTransition ePageTransition = PSPDFPageTransition.Curl; PSPDFPageMode ePageMode = PSPDFPageMode.Automatic; PSPDFScrollDirection eScrollDirection = PSPDFScrollDirection.Horizontal; var oPdfViewer = new PSPDFViewController(document) { ModalPresentationStyle = MonoTouch.UIKit.UIModalPresentationStyle.FullScreen, ModalTransitionStyle = MonoTouch.UIKit.UIModalTransitionStyle.CoverVertical, LinkAction = PSPDFLinkAction.OpenSafari, PageTransition = ePageTransition, PageMode = ePageMode, ScrollDirection = eScrollDirection, RenderAnnotationTypes = PSPDFAnnotationType.Highlight | PSPDFAnnotationType.Ink | PSPDFAnnotationType.Note | PSPDFAnnotationType.Text | PSPDFAnnotationType.Link, Delegate = new PSPDFKitViewControllerDelegate() }; var oControllerClassDic = new NSMutableDictionary(); oControllerClassDic.LowlevelSetObject(new Class(typeof(CustomNoteAnnotationController)).Handle, new Class(typeof(PSPDFNoteAnnotationController)).Handle); oControllerClassDic.LowlevelSetObject(new Class(typeof(CustomLinkAnnotationView)).Handle, new Class(typeof(PSPDFLinkAnnotationView)).Handle); oPdfViewer.OverrideClassNames = oControllerClassDic; List<PSPDFBarButtonItem> aButtons = new List<PSPDFBarButtonItem>() { oPdfViewer.AnnotationButtonItem, oPdfViewer.BookmarkButtonItem, oPdfViewer.SearchButtonItem, oPdfViewer.OutlineButtonItem }; if(bAllowsPrinting && bAllowsExport) { //aButtons.Add(this.oPdfViewer.EmailButtonItem); aButtons.Add(oPdfViewer.PrintButtonItem); aButtons.Add(oPdfViewer.OpenInButtonItem); } aButtons.Add(oPdfViewer.ViewModeButtonItem); oPdfViewer.RightBarButtonItems = aButtons.ToArray(); aButtons = null; oPdfViewer.SetPageAnimated(iInitialPage, false); return oPdfViewer; }
public KSAnnotationsListController(PSPDFDocument document, PSPDFViewController controller) : base(UITableViewStyle.Plain, null) { this.Title = "Annotations"; this.document = document; this.controller = controller; this.Root = new RootElement(string.Empty); //First cell is "loading..." cell and then it is larger cells this.Root.UnevenRows = true; }
public void PdfViewControllerDidDismiss(PSPDFViewController pdfController) { var analytics = PSPDFKitGlobal.SharedInstance.GetAnalytics(); // sending custom events. analytics.LogEvent("catalog_analytics_example_exit"); analytics.RemoveAnalyticsClient(AnalyticsLogger); analytics.Enabled = false; }
public void DidSelectAnnotations(PSPDFViewController pdfController, PSPDFAnnotation [] annotations, PSPDFPageView pageView) { if (annotations == null) { return; } foreach (var annotation in annotations) { Console.WriteLine($"Selected Annotation: {annotation.Name}"); } }
public override bool DidTapOnAnnotation(PSPDFViewController pdfController, PSPDFAnnotation annotation, System.Drawing.PointF annotationPoint, PSPDFAnnotationViewProtocol annotationView, PSPDFPageView pageView, System.Drawing.PointF viewPoint) { if (annotation is PSPDFLinkAnnotation) { var linkAnnot = (PSPDFLinkAnnotation)annotation; Console.WriteLine("Tapped a link annotation!"); var alert = new UIAlertView("TapTap", "Tapped link annotation. Target: " + linkAnnot.SiteLinkTarget, null, null, "OK"); alert.Show(); return(true); } return(false); }
public override bool ShouldHideHud(PSPDFViewController pdfController, bool animated) { if (!Hud_Lock) { if (ShouldHideHudEvent != null) { ShouldHideHudEvent(); } return(true); } return(false); }
public KSCombinedTabBarController (PSPDFViewController controller, PSPDFDocument document) : base () { var tocController = new PSPDFOutlineViewController (document, controller.Handle); tocController.Title = "TOC"; var searchController = new PSPDFSearchViewController (document, controller); searchController.Title = "Search"; var bookmarksController = new PSPDFBookmarkViewController (document); // PSPDFViewController implements PSPDFOutlineViewControllerDelegate as a protocol. bookmarksController.WeakDelegate = controller; bookmarksController.Title = "Bookmarks"; this.SetViewControllers (new UIViewController[] { tocController, searchController, bookmarksController }, false); }
public KSCombinedTabBarController(PSPDFViewController controller, PSPDFDocument document) : base() { var tocController = new PSPDFOutlineViewController(document, controller.Handle); tocController.Title = "TOC"; var searchController = new PSPDFSearchViewController(document, controller); searchController.Title = "Search"; var bookmarksController = new PSPDFBookmarkViewController(document); // PSPDFViewController implements PSPDFOutlineViewControllerDelegate as a protocol. bookmarksController.WeakDelegate = controller; bookmarksController.Title = "Bookmarks"; this.SetViewControllers(new UIViewController[] { tocController, searchController, bookmarksController }, false); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // Create a new window instance based on the screen size window = new UIWindow (UIScreen.MainScreen.Bounds); // Create the document PSPDFDocument document = new PSPDFDocument(NSUrl.FromFilename(Path.Combine(NSBundle.MainBundle.BundlePath, "hackermonthly12.pdf"))); Console.WriteLine("Using document path: " + document.FileURL.Path); // Create the controller and encapsulate it into a UINavigationController for easier access. PSPDFViewController pdfController = new PSPDFViewController (document); UINavigationController navController = new UINavigationController (pdfController); // If you have defined a root view controller, set it here: window.RootViewController = navController; // make the window visible window.MakeKeyAndVisible (); return true; }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // Create a new window instance based on the screen size window = new UIWindow(UIScreen.MainScreen.Bounds); // Create the document PSPDFDocument document = new PSPDFDocument(NSUrl.FromFilename(Path.Combine(NSBundle.MainBundle.BundlePath, "hackermonthly12.pdf"))); Console.WriteLine("Using document path: " + document.FileURL.Path); // Create the controller and encapsulate it into a UINavigationController for easier access. PSPDFViewController pdfController = new PSPDFViewController(document); UINavigationController navController = new UINavigationController(pdfController); // If you have defined a root view controller, set it here: window.RootViewController = navController; // make the window visible window.MakeKeyAndVisible(); return(true); }
protected override void OnElementChanged(VisualElementChangedEventArgs e) { base.OnElementChanged(e); if (e.OldElement != null || Element == null) { return; } var containerController = ViewController; var document = new PSPDFDocument(NSUrl.FromFilename(PdfFilePath)); var pdfController = new PSPDFViewController(document, PSPDFConfiguration.FromConfigurationBuilder((builder) => { builder.UseParentNavigationBar = true; builder.ShouldHideStatusBarWithUserInterface = true; })); var navController = new UINavigationController(pdfController); // just style the controller a little SetNiceColors(navController); // Since we are using Xamarin Forms navigation we need to pop out using it, so we are using `Element` to tell X.F that we are done and pop us out. var menuItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (sender, ev) => { // You can add some logic here before the controller is closed Console.WriteLine("Done with the document."); // Let PDFViewer object know that we want to pop Element.Navigation.PopModalAsync(); }); pdfController.NavigationItem.LeftBarButtonItem = menuItem; containerController.AddChildViewController(navController); navController.View.Frame = containerController.View.Bounds; // make the controller fullscreen in your container controller navController.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight; // ensure the controller resizes along with your container controller containerController.View.AddSubview(navController.View); pdfController.DidMoveToParentViewController(navController); }
public override PSPDFMenuItem[] ShouldShowMenuItemsForSelectedText(PSPDFViewController pdfController, PSPDFMenuItem[] menuItems, CGRect rect, String selectedText, CGRect textRect, PSPDFPageView pageView) { int addIndex = 0; PSPDFMenuItem[] newItems = new PSPDFMenuItem[1]; if (menuItems != null) { for (int i = 0; i < menuItems.Length; i++) { if (menuItems [i].Identifier == "Search") { newItems [addIndex] = menuItems [i]; addIndex++; } } } if (newItems != null && addIndex != 0) { return(newItems); } return(null); }
public override PSPDFMenuItem[] ShouldShowMenuItemsForAnnotations(PSPDFViewController pdfController, PSPDFMenuItem[] menuItems, CGRect rect, PSPDFAnnotation[] annotations, CGRect textRect, PSPDFPageView pageView) { if (annotations != null) { PSPDFMenuItem[] newItems = new PSPDFMenuItem[1]; PSPDFMenuItem removeMenu = new PSPDFMenuItem(StringRef.Remove, delegate { annotations[0].Deleted = true; pageView.RemoveAnnotation(annotations[0], null, true); if (SaveAnnotationEvent != null) { SaveAnnotationEvent(); } }, StringRef.Remove); newItems[0] = removeMenu; return(newItems); } return(menuItems); }
public override PSPDFMenuItem[] ShouldShowMenuItemsForSelectedImage(PSPDFViewController pdfController, PSPDFMenuItem[] menuItems, CGRect rect, PSPDFImageInfo selectedImage, CGRect textRect, PSPDFPageView pageView) { return(null); }
public PSPDFOutlineViewController(PSPDFViewController controller) : this(controller.Document, controller.Handle) { }
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); }) }, }; }
public KSBarButtonItem (PSPDFViewController controller) : base(controller) { }
public KSBarButtonItem(PSPDFViewController controller) : base(controller) { }
public KSAnnotationToolbar(PSPDFViewController controller) : base(controller) { }
public KSCatalogViewController() : base(UITableViewStyle.Grouped, null) { PSPDFKitGlobal.LogLevel = PSPDFLogLevel.Verbose; // Add some custom localization to ensure the bindings work. PSPDFKitGlobal.Localize("en", new NameValueCollection { { "Outline", "File Content" }, { "Bookmarks", "Remember" } }); // Call cache method to ensure the bindings for the cache work. var oPdfCache = PSPDFCache.SharedCache; oPdfCache.ClearCache( ); PSPDFKitGlobal.LogLevel = PSPDFLogLevel.Info; NSUrl samplesURL = NSBundle.MainBundle.ResourceUrl.Append("Samples", true); NSUrl hackerMagURL = samplesURL.Append(HackerMagazineExample, false); NSUrl annotTestURL = samplesURL.Append(AnnotTestExample, false); this.Root = new RootElement("KSCatalogViewController") { new Section("Full example apps", "Can be used as a template for your own apps.") { // PDF playground. new StringElement("PSPDFViewController playground", () => { var doc = new PSPDFDocument(hackerMagURL); var kioskController = new KSKioskViewController(doc); kioskController.StatusBarStyleSetting = PSPDFStatusBarStyleSetting.Default; this.NavigationController.PushViewController(kioskController, true); }), }, new Section("Customizing") { // Combines various view controllers in a tab bar controller. new StringElement("Combine search, TOC and bookmarks", () => { var doc = new PSPDFDocument(hackerMagURL); // Don't use PSPDFVieController directly but a subclass that allows attaching to ViewDidDisappear in order to clear // the RightBarButtonItems property. Otherwise the tabBarBtn would keep a reference to the PSPDFViewController and the instances // would never be freed. //var controller = new PSPDFViewController(doc); var controller = new KSKioskViewController(doc); //controller.ViewDisappeared += (sender, args) => controller.RightBarButtonItems = new PSPDFBarButtonItem[0]; var tabBarController = new KSCombinedTabBarController(controller, doc); var tabBarBtn = new KSBarButtonItem(controller) { Title = "UITabBarController", Style = UIBarButtonItemStyle.Bordered }; tabBarBtn.Clicked += (object sender, EventArgs e) => controller.PresentViewControllerModalOrPopover(tabBarController, true, false, true, tabBarBtn, null); controller.RightBarButtonItems = new PSPDFBarButtonItem[] { controller.AnnotationButtonItem, controller.BookmarkButtonItem, tabBarBtn }; var classDic = new NSMutableDictionary(); classDic.LowlevelSetObject(new Class(typeof(KSInkAnnotation)).Handle, new Class(typeof(PSPDFInkAnnotation)).Handle); classDic.LowlevelSetObject(new Class(typeof(KSNoteAnnotation)).Handle, new Class(typeof(PSPDFNoteAnnotation)).Handle); classDic.LowlevelSetObject(new Class(typeof(KSHighlightAnnotation)).Handle, new Class(typeof(PSPDFHighlightAnnotation)).Handle); doc.OverrideClassNames = classDic; this.NavigationController.PushViewController(controller, true); }), // Shows an alert when tapping a link annotation. new StringElement("Custom reaction on annotation links", () => { var doc = new PSPDFDocument(hackerMagURL); var controller = new PSPDFViewController(doc); controller.Delegate = new KSCatchTappingLinkDelegate(); // There are link annotations on page 2. controller.SetPageAnimated(1, false); this.NavigationController.PushViewController(controller, true); }) }, new Section("Subclassing") { // Subclassing PSPDFAnnotationToolbar new StringElement("Subclass annotation toolbar and drawing toolbar", () => { var doc = new PSPDFDocument(hackerMagURL); var controller = new PSPDFViewController(doc); var barButtons = new List <PSPDFBarButtonItem>(controller.RightBarButtonItems); barButtons.Add(controller.AnnotationButtonItem); controller.RightBarButtonItems = barButtons.ToArray(); var classDic = new NSMutableDictionary(); classDic.LowlevelSetObject(new Class(typeof(KSAnnotationToolbar)).Handle, new Class(typeof(PSPDFAnnotationToolbar)).Handle); controller.OverrideClassNames = classDic; this.NavigationController.PushViewController(controller, true); }), // Demonstrates always visible vertical toolbar. new StringElement("Vertical always-visible annotation bar", () => { var doc = new PSPDFDocument(hackerMagURL); var controller = new KSExampleAnnotationViewController(doc); this.NavigationController.PushViewController(controller, true); }), // Tests potential binding issue when subclassing PSPDFViewController new StringElement("PSPDFViewController with NULL document", () => { var doc = new PSPDFDocument(hackerMagURL); var controller = new KSNoDocumentPDFViewController(); controller.Document = doc; this.NavigationController.PushViewController(controller, true); }), // Demonstrates capturing bookmark set/remove. new StringElement("Capture bookmarks", () => { var doc = new PSPDFDocument(hackerMagURL); // Create an entry for overriding the default bookmark parser. var classDic = new NSMutableDictionary(); classDic.LowlevelSetObject(new Class(typeof(KSBookmarkParser)).Handle, new Class(typeof(PSPDFBookmarkParser)).Handle); doc.OverrideClassNames = classDic; var controller = new PSPDFViewController(doc); controller.RightBarButtonItems = new PSPDFBarButtonItem[] { controller.BookmarkButtonItem, controller.SearchButtonItem, controller.OutlineButtonItem, controller.ViewModeButtonItem }; this.NavigationController.PushViewController(controller, true); }), // Demonstrates custom annotation provider. new StringElement("Custom Annotation Provider", () => { var doc = new PSPDFDocument(hackerMagURL); doc.SetDidCreateDocumentProviderBlock(delegate(PSPDFDocumentProvider documentProvider) { documentProvider.AnnotationParser.AnnotationProviders = new NSObject[] { new KSCustomAnnotationProvider(), documentProvider.AnnotationParser.FileAnnotationProvider }; }); var controller = new PSPDFViewController(doc); this.NavigationController.PushViewController(controller, true); }), // Subclasses PDPFFileAnnotationProvider and injects additional annotations. // This example demonstrates: // * Make all built in annotations (those embedded in the PDF) immutable. // * All annotations added by the user can be modified. // * Workaround for PSPDFKit bug where the text of a non-editable annotation can still be changed. // * Immediate callback if an annotation has been changed. new StringElement("Subclass PSPDFFileAnnotationProvider", () => { var controller = new PSPDFViewController(); var barButtons = new List <PSPDFBarButtonItem>(controller.RightBarButtonItems); barButtons.Add(controller.AnnotationButtonItem); controller.RightBarButtonItems = barButtons.ToArray(); controller.SetPageAnimated(2, false); controller.PageMode = PSPDFPageMode.Automatic; controller.PageTransition = PSPDFPageTransition.ScrollContinuous; controller.ScrollDirection = PSPDFScrollDirection.Horizontal; var classDic = new NSMutableDictionary(); classDic.LowlevelSetObject(new Class(typeof(KSNoteAnnotationController)).Handle, new Class(typeof(PSPDFNoteAnnotationController)).Handle); controller.OverrideClassNames = classDic; this.NavigationController.PushViewController(controller, true); var doc = new KSPDFDocument(hackerMagURL); //var doc = new PSPDFDocument(); //var doc = new PSPDFDocument(annotTestURL); // Create an entry for overriding the file annotation provider. classDic = new NSMutableDictionary(); classDic.LowlevelSetObject(new Class(typeof(KSFileAnnotationProvider)).Handle, new Class(typeof(PSPDFFileAnnotationProvider)).Handle); classDic.LowlevelSetObject(new Class(typeof(KSInkAnnotation)).Handle, new Class(typeof(PSPDFInkAnnotation)).Handle); classDic.LowlevelSetObject(new Class(typeof(KSNoteAnnotation)).Handle, new Class(typeof(PSPDFNoteAnnotation)).Handle); classDic.LowlevelSetObject(new Class(typeof(KSHighlightAnnotation)).Handle, new Class(typeof(PSPDFHighlightAnnotation)).Handle); doc.OverrideClassNames = classDic; controller.Document = doc; }), // Set editable annotation types new StringElement("Set editable annotation types", () => { var doc = new PSPDFDocument(hackerMagURL); var controller = new PSPDFViewController(doc); controller.RightBarButtonItems = new PSPDFBarButtonItem[] { controller.AnnotationButtonItem }; var set = new NSMutableSet(); set.Add(PSPDFAnnotation.PSPDFAnnotationTypeStringInk); set.Add(PSPDFAnnotation.PSPDFAnnotationTypeStringNote); set.Add(PSPDFAnnotation.PSPDFAnnotationTypeStringUnderline); controller.AnnotationButtonItem.AnnotationToolbar.EditableAnnotationTypes = set.ToNSOrderedSet(); this.NavigationController.PushViewController(controller, true); }) } }; }
public KSCatalogViewController () : base (UITableViewStyle.Grouped, null) { NSUrl samplesURL = NSBundle.MainBundle.ResourceUrl.Append ("Samples", true); NSUrl hackerMagURL = samplesURL.Append(HackerMagazineExample, false); NSUrl annotTestURL = samplesURL.Append(AnnotTestExample, false); this.Root = new RootElement ("KSCatalogViewController") { new Section ("Full example apps", "Can be used as a template for your own apps.") { // PDF playground. new StringElement ("PSPDFViewController playground", () => { var doc = new PSPDFDocument(hackerMagURL); var controller = new KSKioskViewController(doc); controller.StatusBarStyleSetting = PSPDFStatusBarStyleSetting.Default; this.NavigationController.PushViewController(controller, true); }), }, new Section("Customizing") { new StringElement("Combine search, TOC and bookmarks", () => { var doc = new PSPDFDocument(hackerMagURL); var controller = new PSPDFViewController(doc); var tabBarController = new KSCombinedTabBarController(controller, doc); var tabBarBtn = new KSBarButtonItem(controller) { Title = "Show!", Style = UIBarButtonItemStyle.Bordered }; tabBarBtn.Clicked += (object sender, EventArgs e) => controller.PresentViewControllerModalOrPopover(tabBarController, true, false, true, tabBarBtn, null); controller.RightBarButtonItems = new PSPDFBarButtonItem[] { controller.BookmarkButtonItem, tabBarBtn }; this.NavigationController.PushViewController(controller, true); }) }, new Section ("Subclassing") { // Subclassing PSPDFAnnotationToolbar new StringElement ("Subclass annotation toolbar and drawing toolbar", () => { var doc = new PSPDFDocument(hackerMagURL); var controller = new PSPDFViewController(doc); var barButtons = new List<PSPDFBarButtonItem>(controller.RightBarButtonItems); barButtons.Add(controller.AnnotationButtonItem); controller.RightBarButtonItems = barButtons.ToArray(); var classDic = new NSMutableDictionary(); classDic.LowlevelSetObject( new Class(typeof(KSAnnotationToolbar)).Handle, new Class(typeof(PSPDFAnnotationToolbar)).Handle); controller.OverrideClassNames = classDic; this.NavigationController.PushViewController(controller, true); }), // Demonstrates always visible vertical toolbar. new StringElement ("Vertical always-visible annotation bar", () => { var doc = new PSPDFDocument(hackerMagURL); var controller = new KSExampleAnnotationViewController(doc); this.NavigationController.PushViewController(controller, true); }), // Tests potential binding issue when subclassing PSPDFViewController new StringElement ("PSPDFViewController with NULL document", () => { var doc = new PSPDFDocument(hackerMagURL); var controller = new KSNoDocumentPDFViewController(); controller.Document = doc; this.NavigationController.PushViewController(controller, true); }), // Demonstrates capturing bookmark set/remove. new StringElement ("Capture bookmarks", () => { var doc = new PSPDFDocument(hackerMagURL); // Create an entry for overriding the default bookmark parser. var classDic = new NSMutableDictionary(); classDic.LowlevelSetObject( new Class(typeof(KSBookmarkParser)).Handle, new Class(typeof(PSPDFBookmarkParser)).Handle); doc.OverrideClassNames = classDic; var controller = new PSPDFViewController(doc); controller.RightBarButtonItems = new PSPDFBarButtonItem[] { controller.BookmarkButtonItem, controller.SearchButtonItem, controller.OutlineButtonItem, controller.ViewModeButtonItem }; this.NavigationController.PushViewController(controller, true); }), // Demonstrates custom annotation provider. new StringElement ("Custom Annotation Provider", () => { var doc = new PSPDFDocument(hackerMagURL); doc.SetDidCreateDocumentProviderBlock(delegate(PSPDFDocumentProvider documentProvider) { documentProvider.AnnotationParser.AnnotationProviders = new NSObject[] { new KSCustomAnnotationProvider(), documentProvider.AnnotationParser.FileAnnotationProvider }; }); var controller = new PSPDFViewController(doc); this.NavigationController.PushViewController(controller, true); }), // Subclasses PDPFFileAnnotationProvider and injects additional annotations. // This example demonstrates: // * Make all built in annotations (those embedded in the PDF) immutable. // * All annotations added by the user can be modified. // * Workaround for PSPDFKit bug where the text of a non-editable annotation can still be changed. // * Immediate callback if an annotation has been changed. new StringElement ("Subclass PSPDFFileAnnotationProvider", () => { var controller = new PSPDFViewController(); var barButtons = new List<PSPDFBarButtonItem>(controller.RightBarButtonItems); barButtons.Add(controller.AnnotationButtonItem); controller.RightBarButtonItems = barButtons.ToArray(); controller.SetPageAnimated(2, false); controller.PageMode = PSPDFPageMode.Automatic; controller.PageTransition = PSPDFPageTransition.ScrollContinuous; controller.ScrollDirection = PSPDFScrollDirection.Horizontal; var classDic = new NSMutableDictionary(); classDic.LowlevelSetObject(new Class(typeof(KSNoteAnnotationController)).Handle, new Class(typeof(PSPDFNoteAnnotationController)).Handle); controller.OverrideClassNames = classDic; this.NavigationController.PushViewController(controller, true); var doc = new KSPDFDocument(hackerMagURL); //var doc = new PSPDFDocument(); //var doc = new PSPDFDocument(annotTestURL); // Create an entry for overriding the file annotation provider. classDic = new NSMutableDictionary(); classDic.LowlevelSetObject( new Class(typeof(KSFileAnnotationProvider)).Handle, new Class(typeof(PSPDFFileAnnotationProvider)).Handle); classDic.LowlevelSetObject( new Class(typeof(KSInkAnnotation)).Handle, new Class(typeof(PSPDFInkAnnotation)).Handle); classDic.LowlevelSetObject( new Class(typeof(KSNoteAnnotation)).Handle, new Class(typeof(PSPDFNoteAnnotation)).Handle); classDic.LowlevelSetObject( new Class(typeof(KSHighlightAnnotation)).Handle, new Class(typeof(PSPDFHighlightAnnotation)).Handle); doc.OverrideClassNames = classDic; controller.Document = doc; }), // Remove annotation toolbar item by setting EditableAnnotationTypes new StringElement ("Remove Ink from the annotation toolbar", () => { var doc = new PSPDFDocument(hackerMagURL); var controller = new PSPDFViewController(doc); // TODO: We need NSMutableOrderedSet bound and NSOrderedSet! /* NSMutableOrderedSet annotTypes = UIDocument.EditableAnnotationTypes; annotTypes.RemoveObject(PSPDFAnnotationTypeStringInk); controller.AnnotationButtonItem.AnnotationToolbar.EditableAnnotationTypes = annotTypes; */ this.NavigationController.PushViewController(controller, true); }) } }; }
public CustomPSPDFBarButtonItem(PSPDFViewController viewController) : base(viewController) { }
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); }) }, }; }
public KSCombinedTabBarController(PSPDFViewController controller, PSPDFDocument document) : base() { this.controller = controller; this.document = document; Console.WriteLine("CONTROLLER AND DOCUMENT!"); }
public KSAnnotationToolbar (PSPDFViewController controller) : base(controller) { }