Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/CoreGraphics PDF/Getpicture PDF
Function:
Required plugins for this example: MBS MacCG Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCG/CoreGraphics PDF/Getpicture PDF
This example is the version from Thu, 16th Nov 2016.
Project "Getpicture PDF.rbp"
FileTypes
Filetype special/any
End FileTypes
Class Window1 Inherits Window
EventHandler Sub DropObject(obj As DragItem, action As Integer) do if obj.FolderItemAvailable then openfile obj.FolderItem end if loop until not obj.NextItem End EventHandler
EventHandler Sub Open() me.AcceptFileDrop "special/any" End EventHandler
Function GetPDFpicture(pdf as cgpdFDocumentMBS) As picture dim r as CGRectMBS dim g as CGContextMBS dim p as Picture // Let's get it in 400% of the size. =288 dpi if pdf<>nil then r=pdf.MediaBox(1) r=CGMakeRectMBS(0,0,r.Width*4,r.Height*4) p = new Picture(r.Width,r.Height,32) p.Graphics.DrawCGPDFDocumentMBS pdf,r,1 Return p end if Exception End Function
Sub openfile(f as folderItem) dim p as CGPDFDocumentMBS if f<>Nil then p=CGOpenPDFDocumentMBS(F) if p<>nil then Title=f.DisplayName Backdrop=getpdfpicture(p) Refresh else MsgBox "Failed to open PDF file!" end if end if End Sub
Property Protected pdf As CGPDFDocumentMBS
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

See also:

Feedback, Comments & Corrections

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




Links
MBS FileMaker Plugins