Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/CoreGraphics PDF/Show 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/Show PDF
This example is the version from Sun, 17th Mar 2012.
Project "Show 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
EventHandler Sub Paint(g As Graphics) dim r as CGRectMBS if pdf<>nil then // if you do not use the mediabox, you can strech the pdf r=pdf.MediaBox(1) r.Left=r.Left+100 // move r.top=r.top+100 'r.Width=r.Width*5 // Scaling? 'r.Height=r.Height*5 'if TargetCocoa then 'dim c as CGContextMBS = GetCurrentCGContextMBS ' 'c.DrawCGPDFDocument pdf,r,1 'else g.DrawCGPDFDocumentMBS pdf,r,1 'end if end if End EventHandler
Sub openfile(f as folderItem) dim p as CGPDFDocumentMBS if f<>Nil then p=CGOpenPDFDocumentMBS(F) if p<>nil then pdf=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 Xojo Chart Plugins