Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

CGOpenPDFDocumentMBS(dataprovider as CGDataProviderMBS) as CGPDFDocumentMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method CoreGraphics MBS MacCG Plugin 5.1 Yes No No Yes, macOS only No
Function: 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
Notes: Returns nil on any error.

Some examples using this method:

Feedback, Comments & Corrections

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




Links
MBS FileMaker Plugins