Platforms to show: All Mac Windows Linux Cross-Platform
Back to PDFPageMBS class.
PDFPageMBS.addAnnotation(annotation as PDFAnnotationMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
PDFPageMBS.annotationAtPoint(x as single, y as single) as PDFAnnotationMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The point is in page-space.
PDFPageMBS.annotations as PDFAnnotationMBS()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The elements of the array will most likely be typed to subclasses of the PDFAnnotation class.
Available in Mac OS X v10.4 and later.
PDFPageMBS.boundsForBox(box as Integer) as NSRectMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
property | PDFKit | MBS PDFKit Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The PDFDisplayBox enumeration defines the various box types.
Note that only the media box is required for a PDF. If you request the bounds for the crop box, but the PDF does not include a crop box, the bounds for the media box are returned instead. If you request the bounds for other box types, and the PDF does not includes these types, the bounds for the crop box are returned instead.
The coordinates for the box are in page space, so you might need to transform the points if the page has a rotation on it. Also, note that the bounds boundsForBox returns are intersected with the page's media box.
boundsForBox throws a range exception if box is not in range.
(Read and Write computed property)
Some examples using this property:
PDFPageMBS.CalcTransformForBox(box as Integer) as Variant
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 12.5 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Returns NSAffineTransformMBS object.
PDFPageMBS.characterBoundsAtIndex(index as Integer) as NSRectMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
In the unlikely event that more than one character are at the specified point, only the first character encountered is returned.
PDFPageMBS.characterIndexAtPoint(x as single, y as single) as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns -1 if no character at point.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
You draw the content using drawRect event.
See also:
PDFPageMBS.Constructor(Handle as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Please pass in a non zero handle which points to a PDFPage object.
For use with declares.
See also:
PDFPageMBS.Constructor(image as NSImageMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
An easy way to create a PDFPage from an image to add to a PDFDocument.
Mac OS X 10.5 only.
See also:
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 13.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 15.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
PDFPageMBS.Draw(g as NSGraphicsMBS, box as Integer = 0)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 12.1 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
Use kPDFDisplay*Box constants for box parameter.
PDFPageMBS.drawWithBox(box as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
This method takes into account the page rotation and draws clipped to the specified box. If the page is set to display annotations, this method also draws them. This method does not clear the background. To clear the background before drawing, use NSRectFill with NSColor set (typically) to white.
PDFPageMBS.removeAnnotation(annotation as PDFAnnotationMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
PDFPageMBS.Render(dpi as Double = 72.0, box as Integer = 0, background as NSColorMBS = nil) as NSImageMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 10.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
dpi: The resolution you want to have on the image. Default 72.0. To get a scaled image with factor x, pass 72.0*x.
box: The display box. Use one of the kPDFDisplayBox* constants.
background: optional NSColorMBS object to fill the background before drawing the PDF. This will affect only PDFs with transparent background.
Returns nil on any error.
Version 11.1pr8 adds code here to handle rotation better.
Due to bugs in Apple’s PDFKit you may see memory leaks with JPEG data from PDF pages (seen in macOS 10.12).
PDFPageMBS.selectionForLineAtPoint(left as single, top as single) as PDFSelectionMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
May return nil if no character (and by extension no line) under point.
PDFPageMBS.selectionForRange(position as Integer, length as Integer) as PDFSelectionMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Will raise an exception if the range length is zero or if the range is outside the range of the characters on the page.
PDFPageMBS.selectionForRect(left as single, top as single, width as single, height as single) as PDFSelectionMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
PDFPageMBS.selectionForWordAtPoint(left as single, top as single) as PDFSelectionMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
May return nil if no character (and by extension no word) under point.
PDFPageMBS.selectionFromPointToPoint(startleft as single, starttop as single, endleft as single, endtop as single) as PDFSelectionMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Point are sorted first top to bottom, left to right.
PDFPageMBS.thumbnailOfSize(size as NSSizeMBS, box as integer) as NSImageMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Note that the produced image is "size to fit": it retains the original page aspect-ratio. The size you give may not match the size of the returned image, but the returned image is guaranteed to be equal or less.
Available in macOS 10.13 or newer.
PDFPageMBS.transformContextForBox(box as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 8.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
This is a convenient method to call from within drawPage or from within the draw method a PDFAnnotation subclass.
Mac OS X 10.5 only.
Some examples using this method:
PDFPageMBS.transformForBox(box as integer) as variant
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | PDFKit | MBS PDFKit Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Available in macOS 10.13 or newer.
The items on this page are in the following plugins: MBS PDFKit Plugin.
