« New universal Hash an… | Home | FileMaker Meeting in … »

Print to PDF File on Mac OS X with Xojo

Today I found a way to print to PDF file in Cocoa app with Xojo. Next plugin prerelease will have the required functions to have this code work:

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.
24 02 14 - 15:55