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);
		}
예제 #2
0
        //
        // 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;
        }
예제 #3
0
 public CGPDFPage TryLockWithDocumentPageError(PSPDFDocument document, uint page, out NSError error)
 {
     IntPtr ptr = TryLockWithDocumentPageError_ (document, page, out error);
     return new CGPDFPage(ptr);
 }
예제 #4
0
 public PSPDFDocumentProvider(CGDataProvider dataProvider, PSPDFDocument document)
     : this(dataProvider.Handle, document)
 {
 }
예제 #5
0
 public MonoTouch.UIKit.UIImage CachedImageForDocument(PSPDFDocument document, uint page, PSPDFSize size, CGPDFPage /*CGPDFPageRef*/ pdfPage)
 {
     return CachedImageForDocument_ (document, page, size, pdfPage.Handle);
 }
예제 #6
0
 public PSPDFTextParser(CGPDFPage pageRef, uint page, PSPDFDocument document, NSMutableDictionary fontCache, bool hideGlyphsOutsidePageRect, CGPDFBox PDFBox)
     : this(pageRef.Handle, page, document, fontCache, hideGlyphsOutsidePageRect, PDFBox)
 {
 }
		public KSExampleAnnotationViewController (PSPDFDocument doc) : base(doc)
		{
		}
예제 #8
0
 public PSPDFDocumentProvider(CGDataProvider dataProvider, PSPDFDocument document) : this(dataProvider.Handle, document)
 {
 }
예제 #9
0
 public PSPDFTextParser(CGPDFPage pageRef, uint page, PSPDFDocument document, NSMutableDictionary fontCache, bool hideGlyphsOutsidePageRect, CGPDFBox PDFBox) : this(pageRef.Handle, page, document, fontCache, hideGlyphsOutsidePageRect, PDFBox)
 {
 }
예제 #10
0
        public CGPDFPage LockWithDocumentPageError(PSPDFDocument document, uint page, out NSError error)
        {
            IntPtr ptr = LockWithDocumentPageError_(document, page, out error);

            return(new CGPDFPage(ptr));
        }
예제 #11
0
 public MonoTouch.UIKit.UIImage CachedImageForDocument(PSPDFDocument document, uint page, PSPDFSize size, CGPDFPage /*CGPDFPageRef*/ pdfPage)
 {
     return(CachedImageForDocument_(document, page, size, pdfPage.Handle));
 }
		public KSKioskViewController (PSPDFDocument doc) : base(doc)
		{
		}
		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);
					})
				}
			};
		}