Print to PDF File on Mac OS X with Xojo
Sub Action()
// print to PDF in Xojo Cocoa app
// change print info to go to
dim s as NSPrintInfoMBS = NSPrintInfoMBS.sharedPrintInfo
dim d as MemoryBlock = s.data // save old
s.SetSaveDestination SpecialFolder.Desktop.Child("test.pdf")
// now print something
dim g as Graphics = OpenPrinter
If g <> Nil Then
g.DrawString "Hello World PDF", 20, 20
End If
s.data = d // restore original settings
// now print something to regular printer
g = OpenPrinter
If g <> Nil Then
g.DrawString "Hello World Printer", 20, 20
End If
End Sub
PS: New plugin is in dropbox.