Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 82 additions & 2 deletions src/pdfkit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
#if MONOMAC
using AppKit;
using UIViewController = Foundation.NSObject;
using UIFindInteraction = Foundation.NSObject;
using UIFindInteractionDelegate = Foundation.NSObject;
using UIView = AppKit.NSView;
#else
using UIKit;
using NSColor = UIKit.UIColor;
Expand All @@ -49,6 +52,7 @@
using Foundation;
using ObjCRuntime;
using CoreGraphics;
using System.ComponentModel;

#if !NET
using NativeHandle = System.IntPtr;
Expand Down Expand Up @@ -403,6 +407,31 @@ interface PdfDocumentAttributeKeys {
NSString KeywordsKey { get; }
}

[Mac (13,0), iOS (16,0), MacCatalyst (16,0)]
[StrongDictionary ("PdfPageImageInitializationOptionKeys")]
interface PdfPageImageInitializationOption {
CGRect MediaBox { get; set; }
int Rotation { get; set; }
bool UpscaleIfSmaller { get; set; }
double CompressionQuality { get; set; }
}

[Mac (13,0), iOS (16,0), MacCatalyst (16,0)]
[Static]
interface PdfPageImageInitializationOptionKeys {
[Field ("PDFPageImageInitializationOptionMediaBox")]
NSString MediaBoxKey { get; }

[Field ("PDFPageImageInitializationOptionRotation")]
NSString RotationKey { get; }

[Field ("PDFPageImageInitializationOptionUpscaleIfSmaller")]
NSString UpscaleIfSmallerKey { get; }

[Field ("PDFPageImageInitializationOptionCompressionQuality")]
NSString CompressionQualityKey { get; }
}

[iOS (11,0)]
[StrongDictionary ("PdfDocumentAttributeKeys")]
interface PdfDocumentAttributes {
Expand Down Expand Up @@ -432,6 +461,14 @@ interface PdfDocumentWriteOptionKeys {
[iOS (15,0), Mac (12,0), MacCatalyst (15,0)]
[Field ("PDFDocumentAccessPermissionsOption", "+PDFKit")]
NSString AccessPermissionsKey { get; }

[iOS (16,0), Mac (13,0), MacCatalyst (16,0)]
[Field ("PDFDocumentBurnInAnnotationsOption", "+PDFKit")]
NSString BurnInAnnotationsKey { get; }

[iOS (16,0), Mac (13,0), MacCatalyst (16,0)]
[Field ("PDFDocumentSaveTextFromOCROption", "+PDFKit")]
NSString SaveTextFromOcrKey { get; }
}

[Mac (10,13)]
Expand Down Expand Up @@ -1524,10 +1561,19 @@ interface PdfPage : NSCopying {
[DesignatedInitializer]
NativeHandle Constructor ();

[DesignatedInitializer]
[Export ("initWithImage:")]
NativeHandle Constructor (NSImage image);

[EditorBrowsable (EditorBrowsableState.Advanced)]
[Mac (13,0), iOS (16,0), MacCatalyst (16,0)]
[DesignatedInitializer]
[Export ("initWithImage:options:")]
NativeHandle Constructor (NSImage image, NSDictionary options);

[Mac (13,0), iOS (16,0), MacCatalyst (16,0)]
[Wrap ("this (image, options.GetDictionary ()!)")]
NativeHandle Constructor (NSImage image, PdfPageImageInitializationOption options);

[Export ("document"), NullAllowed]
PdfDocument Document { get; }

Expand Down Expand Up @@ -1743,7 +1789,7 @@ interface PdfThumbnailView : NSCoding {
[BaseType (typeof (NSView), Name = "PDFView", Delegates = new string [] { "WeakDelegate" }, Events = new Type [] { typeof (PdfViewDelegate) })]
interface PdfView :
#if IOS
UIGestureRecognizerDelegate
UIGestureRecognizerDelegate, UIFindInteractionDelegate
#else
NSMenuDelegate, NSAnimationDelegate
#endif
Expand Down Expand Up @@ -2065,6 +2111,22 @@ interface PdfView :
[Mac (10,13)]
[Export ("acceptsDraggedFiles")]
bool AcceptsDraggedFiles { get; set; }

[iOS (16,0), Mac (13,0), MacCatalyst (16,0)]
[NullAllowed, Export ("pageOverlayViewProvider", ArgumentSemantic.Weak)]
IPdfPageOverlayViewProvider PageOverlayViewProvider { get; set; }

[iOS (16,0), Mac (13,0), MacCatalyst (16,0)]
[Export ("inMarkupMode")]
bool InMarkupMode { [Bind ("isInMarkupMode")] get; set; }

[iOS (16,0), NoMac, MacCatalyst (16,0)]
[Export ("findInteraction")]
UIFindInteraction FindInteraction { get; }

[iOS (16,0), NoMac, MacCatalyst (16,0)]
[Export ("findInteractionEnabled")]
bool FindInteractionEnabled { [Bind ("isFindInteractionEnabled")] get; set; }
}

[NoiOS]
Expand Down Expand Up @@ -2118,4 +2180,22 @@ interface PdfViewDelegate {
UIViewController ParentViewController { get; }
}

[Mac (13,0), iOS (16,0), MacCatalyst (16,0)]
interface IPdfPageOverlayViewProvider {}

[Mac (13,0), iOS (16,0), MacCatalyst (16,0)]
[Protocol (Name = "PDFPageOverlayViewProvider")]
interface PdfPageOverlayViewProvider
{
[Abstract]
[Export ("pdfView:overlayViewForPage:")]
[return: NullAllowed]
UIView GetOverlayView (PdfView view, PdfPage page);

[Export ("pdfView:willDisplayOverlayView:forPage:")]
void WillDisplayOverlayView (PdfView pdfView, UIView overlayView, PdfPage page);

[Export ("pdfView:willEndDisplayingOverlayView:forPage:")]
void WillEndDisplayingOverlayView (PdfView pdfView, UIView overlayView, PdfPage page);
}
}
7 changes: 6 additions & 1 deletion src/uikit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25258,7 +25258,7 @@ interface UIPasteControlConfiguration : NSSecureCoding

interface IUIFindInteractionDelegate {}

[NoWatch, NoTV, iOS (16,0), MacCatalyst (16,0)]
[NoWatch, NoTV, iOS (16,0), MacCatalyst (16,0), NoMac]
#if NET
[Protocol, Model]
#else
Expand All @@ -25267,6 +25267,11 @@ interface IUIFindInteractionDelegate {}
[BaseType (typeof(NSObject))]
interface UIFindInteractionDelegate
{
// This abstract method needs attributes since PDFKit.PDFView
// implements this interface and has iOS 11 support. When inlining
// this method, the attributes are not carried over and causes issues
// since it is not supported until iOS 16
[NoWatch, NoTV, iOS (16,0), MacCatalyst (16,0), NoMac]
[Abstract]
[Export ("findInteraction:sessionForView:")]
[return: NullAllowed]
Expand Down
17 changes: 0 additions & 17 deletions tests/xtro-sharpie/api-annotations-dotnet/iOS-PDFKit.todo

This file was deleted.

13 changes: 0 additions & 13 deletions tests/xtro-sharpie/api-annotations-dotnet/macOS-PDFKit.todo

This file was deleted.

17 changes: 0 additions & 17 deletions tests/xtro-sharpie/iOS-PDFKit.todo

This file was deleted.

13 changes: 0 additions & 13 deletions tests/xtro-sharpie/macOS-PDFKit.todo

This file was deleted.