MBS Plugin Documentation

Search:

Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchie

New in Version 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 9.0

The list of the   themes,   classes,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

PDFPageMBS.addAnnotation(annotation as PDFAnnotationMBS)
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Methods allowing annotations to be added.
PDFPageMBS.annotationAtPoint(x as single, y as single) as PDFAnnotationMBS
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Hit-testing method returns the annotation at point (or nil if none).
Notes: The point is in page-space.
PDFPageMBS.annotations as PDFAnnotationArrayMBS
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Array of PDFAnnotation objects.
Notes:
(actually, more likely specific PDFAnnotation subclasses like PDFAnnotationLink, etc.).

Returns nil on errors.
PDFPageMBS.attributedString as NSAttributedStringMBS
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: String (with linefeeds and in some cases spaces inserted) representing the text on the page.
PDFPageMBS.boundsForBox(box as integer, byref x as single, byref y as single, byref w as single, byref h as single) as boolean
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Returns the bounds of the requested box.
Notes:
Returns true on success and false on failure.
May still return a zeros.
PDFPageMBS.characterBoundsAtIndex(index as integer, byref x as single, byref y as single, byref w as single, byref h as single) as integer
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Returns the bounds in page-space of the character at index.
Notes: 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
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Returns the index of the character at point (in page space).
Notes: Returns -1 if no character at point.
class PDFPageMBS
class, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: The PDFKit class for a page in a pdf document.
Example:
dim file1,file2,file3,destfile as FolderItem
dim page1,page2,page3 as PDFPageMBS
dim doc1,doc2 as PDFDocumentMBS
dim img as NSImageMBS
dim doc as PDFDocumentMBS

file1=DesktopFolder.Child("test1.pdf")
file2=DesktopFolder.Child("test2.pdf")
file3=DesktopFolder.Child("logo.jpg")

doc1=new PDFDocumentMBS(file1)
doc2=new PDFDocumentMBS(file2)

MsgBox str(doc1.pageCount)

img=new NSImageMBS(file3)

Backdrop=img.CopyPicture

page1=new PDFPageMBS(img)
page2=doc1.pageAtIndex(0)
page3=doc2.pageAtIndex(0)

doc=new PDFDocumentMBS
doc.insertPage page1,0
doc.insertPage page2,1
doc.insertPage page3,2

destfile=DesktopFolder.Child("test.pdf")
call doc.write(destfile)


PDFPageMBS.Constructor
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 8.0, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: The constructor to create a custom PDF page.
Example:
dim doc as new PDFDocumentMBS
dim page as PDFPageMBS
dim f as FolderItem

page=new MyPDFPageMBS

doc.Creator="Realbasic"
doc.Title="Test file"

doc.insertPage page,0

f=DesktopFolder.Child("test.pdf")

if doc.write(f) then
f.launch
end if

Notes: You draw the content using drawRect event.
PDFPageMBS.Constructor(image as NSImageMBS)
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 8.0, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Creates a PDFPage for the NSImage passed in.
Notes:
An easy way to create a PDFPage from an image to add to a PDFDocument.

Mac OS X 10.5 only.
PDFPageMBS.dataRepresentation as string
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Returns PDF data (a proper PDF document) consisting of a single page (this page).
Notes: Note, external page links are not preserved.
PDFPageMBS.displaysAnnotations as boolean
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Method to turn on or off the display of annotations when the page is drawn.
Notes: (Read and Write runtime property)
PDFPageMBS.document as PDFDocumentMBS
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: The PDFDocument the page is associated with.
PDFPageMBS.draw(box as integer)
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 8.0, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Drawing method takes into account page rotation, draws in page space relative to and clipped to the box bounds.
Notes:
If displaysAnnotations is true, also draws any page annotations. Does not clear the background (page white).

use the kPDFDisplayBox constants for the box parameter.
PDFPageMBS.drawRect(box as integer, g as NSGraphicsMBS)
event, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Plugin version: 8.0, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: The event called when the PDFPage needs to be drawn.
Example:
Sub drawRect(box as integer, g as NSGraphicsMBS)

if g.Valid then
System.DebugLog "is valid"
else
System.DebugLog "not valid"
end if

g.SetColorRGB 0,1,0

g.drawRect 200,200,200,200

g.SetColorRGB 1,0,0

g.fillRect 100,100,100,100
End Sub

Notes:
Do not store the graphics reference as it is only valid in this event.
Use the kPDFDisplayBox* constants for the box value.
PDFPageMBS.kPDFDisplayBoxArtBox=4
const, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: One of the constants to use for page boxes.
PDFPageMBS.kPDFDisplayBoxBleedBox=2
const, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: One of the constants to use for page boxes.
PDFPageMBS.kPDFDisplayBoxCropBox=1
const, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: One of the constants to use for page boxes.
PDFPageMBS.kPDFDisplayBoxMediaBox=0
const, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: One of the constants to use for page boxes.
PDFPageMBS.kPDFDisplayBoxTrimBox=3
const, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: One of the constants to use for page boxes.
PDFPageMBS.label as string
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: The page label. Usually "1" for the first page, "2" for the second, etc.
PDFPageMBS.numberOfCharacters as integer
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Number of characters on the page (including linefeeds and spaces inserted).
PDFPageMBS.removeAnnotation(annotation as PDFAnnotationMBS)
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Methods allowing annotations to be removed.
PDFPageMBS.rotation as integer
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Rotation on a page.
Notes:
Must be 0, 90, 180 or 270 (negative rotations will be "normalized" to one of 0, 90, 180 or 270).
Some PDF's have an inherent rotation and so rotation may be non-zero when a PDF is first opened.
(Read and Write runtime property)
PDFPageMBS.selectionForLineAtPoint(left as single, top as single) as PDFSelectionMBS
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Given a point in page-space, returns a selection representing a whole line at that point.
Notes: May return nil if no character (and by extension no line) under point.
PDFPageMBS.selectionForRange(position as integer, length as integer) as PDFSelectionMBS
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Given a range, returns a selection representing text within that range.
Notes: 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
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Given a rect in page-space, returns a selection representing enclosed text on page.
PDFPageMBS.selectionForWordAtPoint(left as single, top as single) as PDFSelectionMBS
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Given a point in page-space, returns a selection representing a whole word at that point.
Notes: 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
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Returns a selection representing text between startPt and endPt.
Notes: Point are sorted first top to bottom, left to right.
PDFPageMBS.setBounds(box as integer, x as single, y as single, w as single, h as single) as boolean
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Sets the bounds of the requested box.
Notes:
Returns true on success and false on failure.
May still return a zeros.
PDFPageMBS.stringValue as string
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 7.6, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: String (with linefeeds and in some cases spaces inserted) representing the text on the page.
Example:
dim p as PDFDocumentMBS
dim f as FolderItem

f=DesktopFolder.Child("test.pdf")
p=new PDFDocumentMBS(f)

MsgBox "Text from first page:"+EndOfLine+EndOfLine+p.pageAtIndex(0).stringValue

PDFPageMBS.transformContextForBox(box as integer)
method, PDFKit, MBS Cocoa Plugin (PDFKit), class PDFPageMBS, Console safe, Plugin version: 8.0, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.

Function: Given a display box, will transform the current context to take into account the rotation of the page as well as the origin of the box with repect to the page's base coordinates system.
Notes:
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.

The items on this page are in the following plugins: MBS Cocoa Plugin.