Platforms to show: All Mac Windows Linux Cross-Platform

CGOpenPDFDocumentMBS(dataprovider as CGDataProviderMBS) as CGPDFDocumentMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method CoreGraphics MBS MacCG Plugin 5.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Opens a CG PDF Document from a data stream.
Example
Sub Paint(g As Graphics)
// window.paint event
dim f as FolderItem
dim b as BinaryStream
dim s as string
dim d as CGDataProviderMBS
dim p as CGPDFDocumentMBS

// get a folderitem to a pdf file.
f=SpecialFolder.Desktop.Child("notes.pdf")

// load the content in a string variable
b=f.OpenAsBinaryFile(false)
s=b.Read(b.Length)
b.Close

// now make a CGDataProvider based on a string.
d=CGDataProviderMBS.CreateWithData(s)

// Open the PDF from the Data Provider
p=CGOpenPDFDocumentMBS(d)

// And play with it
g.DrawCGPDFDocumentMBS p,p.MediaBox(1),1

Exception
// trouble goes here.
End Sub

Returns nil on any error.

Some examples using this global method:

CGOpenPDFDocumentMBS(file as folderitem) as CGPDFDocumentMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
Opens a PDF document.

RB 4.5 should do this perfectly, but older RB versions may have problems with longer file names.
Requires Mac OS X to work.

Some examples using this global method:

Blog Entries

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


The biggest plugin in space...