objc2_pdf_kit/generated/
PDFPage.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9#[cfg(feature = "objc2-core-foundation")]
10use objc2_core_foundation::*;
11#[cfg(feature = "objc2-core-graphics")]
12use objc2_core_graphics::*;
13use objc2_foundation::*;
14
15use crate::*;
16
17#[repr(transparent)]
20#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
21pub struct PDFAreaOfInterest(pub NSInteger);
22bitflags::bitflags! {
23 impl PDFAreaOfInterest: NSInteger {
24 #[doc(alias = "kPDFNoArea")]
25 const NoArea = 0;
26 #[doc(alias = "kPDFPageArea")]
27 const PageArea = 1<<0;
28 #[doc(alias = "kPDFTextArea")]
29 const TextArea = 1<<1;
30 #[doc(alias = "kPDFAnnotationArea")]
31 const AnnotationArea = 1<<2;
32 #[doc(alias = "kPDFLinkArea")]
33 const LinkArea = 1<<3;
34 #[doc(alias = "kPDFControlArea")]
35 const ControlArea = 1<<4;
36 #[doc(alias = "kPDFTextFieldArea")]
37 const TextFieldArea = 1<<5;
38 #[doc(alias = "kPDFIconArea")]
39 const IconArea = 1<<6;
40 #[doc(alias = "kPDFPopupArea")]
41 const PopupArea = 1<<7;
42 #[doc(alias = "kPDFImageArea")]
43 const ImageArea = 1<<8;
44 #[doc(alias = "kPDFAnyArea")]
45 const AnyArea = NSIntegerMax as _;
46 }
47}
48
49unsafe impl Encode for PDFAreaOfInterest {
50 const ENCODING: Encoding = NSInteger::ENCODING;
51}
52
53unsafe impl RefEncode for PDFAreaOfInterest {
54 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
55}
56
57#[repr(transparent)]
60#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
61pub struct PDFDisplayBox(pub NSInteger);
62impl PDFDisplayBox {
63 #[doc(alias = "kPDFDisplayBoxMediaBox")]
64 pub const MediaBox: Self = Self(0);
65 #[doc(alias = "kPDFDisplayBoxCropBox")]
66 pub const CropBox: Self = Self(1);
67 #[doc(alias = "kPDFDisplayBoxBleedBox")]
68 pub const BleedBox: Self = Self(2);
69 #[doc(alias = "kPDFDisplayBoxTrimBox")]
70 pub const TrimBox: Self = Self(3);
71 #[doc(alias = "kPDFDisplayBoxArtBox")]
72 pub const ArtBox: Self = Self(4);
73}
74
75unsafe impl Encode for PDFDisplayBox {
76 const ENCODING: Encoding = NSInteger::ENCODING;
77}
78
79unsafe impl RefEncode for PDFDisplayBox {
80 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
81}
82
83pub type PDFPageImageInitializationOption = NSString;
86
87extern_class!(
88 #[unsafe(super(NSObject))]
90 #[derive(Debug, PartialEq, Eq, Hash)]
91 pub struct PDFPage;
92);
93
94extern_conformance!(
95 unsafe impl NSCopying for PDFPage {}
96);
97
98unsafe impl CopyingHelper for PDFPage {
99 type Result = Self;
100}
101
102extern_conformance!(
103 unsafe impl NSObjectProtocol for PDFPage {}
104);
105
106impl PDFPage {
107 extern_methods!(
108 #[unsafe(method(init))]
109 #[unsafe(method_family = init)]
110 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
111
112 #[cfg(feature = "objc2-app-kit")]
113 #[cfg(target_os = "macos")]
114 #[unsafe(method(initWithImage:options:))]
118 #[unsafe(method_family = init)]
119 pub unsafe fn initWithImage_options(
120 this: Allocated<Self>,
121 image: &NSImage,
122 options: &NSDictionary<PDFPageImageInitializationOption, AnyObject>,
123 ) -> Option<Retained<Self>>;
124
125 #[cfg(feature = "objc2-app-kit")]
126 #[cfg(target_os = "macos")]
127 #[unsafe(method(initWithImage:))]
128 #[unsafe(method_family = init)]
129 pub unsafe fn initWithImage(
130 this: Allocated<Self>,
131 image: &NSImage,
132 ) -> Option<Retained<Self>>;
133
134 #[cfg(feature = "PDFDocument")]
135 #[unsafe(method(document))]
136 #[unsafe(method_family = none)]
137 pub unsafe fn document(&self) -> Option<Retained<PDFDocument>>;
138
139 #[cfg(feature = "objc2-core-graphics")]
140 #[unsafe(method(pageRef))]
141 #[unsafe(method_family = none)]
142 pub unsafe fn pageRef(&self) -> Option<Retained<CGPDFPage>>;
143
144 #[unsafe(method(label))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn label(&self) -> Option<Retained<NSString>>;
147
148 #[unsafe(method(boundsForBox:))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn boundsForBox(&self, r#box: PDFDisplayBox) -> NSRect;
151
152 #[unsafe(method(setBounds:forBox:))]
153 #[unsafe(method_family = none)]
154 pub unsafe fn setBounds_forBox(&self, bounds: NSRect, r#box: PDFDisplayBox);
155
156 #[unsafe(method(rotation))]
157 #[unsafe(method_family = none)]
158 pub unsafe fn rotation(&self) -> NSInteger;
159
160 #[unsafe(method(setRotation:))]
162 #[unsafe(method_family = none)]
163 pub unsafe fn setRotation(&self, rotation: NSInteger);
164
165 #[cfg(feature = "PDFAnnotation")]
166 #[unsafe(method(annotations))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn annotations(&self) -> Retained<NSArray<PDFAnnotation>>;
169
170 #[unsafe(method(displaysAnnotations))]
171 #[unsafe(method_family = none)]
172 pub unsafe fn displaysAnnotations(&self) -> bool;
173
174 #[unsafe(method(setDisplaysAnnotations:))]
176 #[unsafe(method_family = none)]
177 pub unsafe fn setDisplaysAnnotations(&self, displays_annotations: bool);
178
179 #[cfg(feature = "PDFAnnotation")]
180 #[unsafe(method(addAnnotation:))]
181 #[unsafe(method_family = none)]
182 pub unsafe fn addAnnotation(&self, annotation: &PDFAnnotation);
183
184 #[cfg(feature = "PDFAnnotation")]
185 #[unsafe(method(removeAnnotation:))]
186 #[unsafe(method_family = none)]
187 pub unsafe fn removeAnnotation(&self, annotation: &PDFAnnotation);
188
189 #[cfg(feature = "PDFAnnotation")]
190 #[unsafe(method(annotationAtPoint:))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn annotationAtPoint(&self, point: NSPoint) -> Option<Retained<PDFAnnotation>>;
193
194 #[cfg(feature = "objc2-core-foundation")]
195 #[unsafe(method(transformForBox:))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn transformForBox(&self, r#box: PDFDisplayBox) -> CGAffineTransform;
198
199 #[cfg(feature = "objc2-core-graphics")]
200 #[unsafe(method(drawWithBox:toContext:))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn drawWithBox_toContext(&self, r#box: PDFDisplayBox, context: &CGContext);
203
204 #[cfg(feature = "objc2-core-graphics")]
205 #[unsafe(method(transformContext:forBox:))]
206 #[unsafe(method_family = none)]
207 pub unsafe fn transformContext_forBox(&self, context: &CGContext, r#box: PDFDisplayBox);
208
209 #[cfg(feature = "objc2-app-kit")]
210 #[cfg(target_os = "macos")]
211 #[unsafe(method(thumbnailOfSize:forBox:))]
212 #[unsafe(method_family = none)]
213 pub unsafe fn thumbnailOfSize_forBox(
214 &self,
215 size: NSSize,
216 r#box: PDFDisplayBox,
217 ) -> Retained<NSImage>;
218
219 #[unsafe(method(numberOfCharacters))]
220 #[unsafe(method_family = none)]
221 pub unsafe fn numberOfCharacters(&self) -> NSUInteger;
222
223 #[unsafe(method(string))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn string(&self) -> Option<Retained<NSString>>;
226
227 #[unsafe(method(attributedString))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn attributedString(&self) -> Option<Retained<NSAttributedString>>;
230
231 #[unsafe(method(characterBoundsAtIndex:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn characterBoundsAtIndex(&self, index: NSInteger) -> NSRect;
234
235 #[unsafe(method(characterIndexAtPoint:))]
236 #[unsafe(method_family = none)]
237 pub unsafe fn characterIndexAtPoint(&self, point: NSPoint) -> NSInteger;
238
239 #[cfg(feature = "PDFSelection")]
240 #[unsafe(method(selectionForRect:))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn selectionForRect(&self, rect: NSRect) -> Option<Retained<PDFSelection>>;
243
244 #[cfg(feature = "PDFSelection")]
245 #[unsafe(method(selectionForWordAtPoint:))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn selectionForWordAtPoint(
248 &self,
249 point: NSPoint,
250 ) -> Option<Retained<PDFSelection>>;
251
252 #[cfg(feature = "PDFSelection")]
253 #[unsafe(method(selectionForLineAtPoint:))]
254 #[unsafe(method_family = none)]
255 pub unsafe fn selectionForLineAtPoint(
256 &self,
257 point: NSPoint,
258 ) -> Option<Retained<PDFSelection>>;
259
260 #[cfg(feature = "PDFSelection")]
261 #[unsafe(method(selectionFromPoint:toPoint:))]
262 #[unsafe(method_family = none)]
263 pub unsafe fn selectionFromPoint_toPoint(
264 &self,
265 start_point: NSPoint,
266 end_point: NSPoint,
267 ) -> Option<Retained<PDFSelection>>;
268
269 #[cfg(feature = "PDFSelection")]
270 #[unsafe(method(selectionForRange:))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn selectionForRange(&self, range: NSRange) -> Option<Retained<PDFSelection>>;
273
274 #[unsafe(method(dataRepresentation))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn dataRepresentation(&self) -> Option<Retained<NSData>>;
277 );
278}
279
280impl PDFPage {
282 extern_methods!(
283 #[unsafe(method(new))]
284 #[unsafe(method_family = new)]
285 pub unsafe fn new() -> Retained<Self>;
286 );
287}
288
289impl PDFPage {
291 extern_methods!(
292 #[deprecated]
293 #[unsafe(method(drawWithBox:))]
294 #[unsafe(method_family = none)]
295 pub unsafe fn drawWithBox(&self, r#box: PDFDisplayBox);
296
297 #[deprecated]
298 #[unsafe(method(transformContextForBox:))]
299 #[unsafe(method_family = none)]
300 pub unsafe fn transformContextForBox(&self, r#box: PDFDisplayBox);
301 );
302}
303
304extern "C" {
305 pub static PDFPageImageInitializationOptionMediaBox: &'static PDFPageImageInitializationOption;
307}
308
309extern "C" {
310 pub static PDFPageImageInitializationOptionRotation: &'static PDFPageImageInitializationOption;
312}
313
314extern "C" {
315 pub static PDFPageImageInitializationOptionUpscaleIfSmaller:
317 &'static PDFPageImageInitializationOption;
318}
319
320extern "C" {
321 pub static PDFPageImageInitializationOptionCompressionQuality:
323 &'static PDFPageImageInitializationOption;
324}