CGDataProvider: CGOpenPDFDocumentMBS

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

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

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.


💬 Ask a question or report a problem