« Quicklist - Fast list… | Home | Winterthur Xojo Meeti… »

Tip of the day: Print to PDF with OpenPrinter in Xojo

This little example code shows how to redirect printing to a PDF file in Xojo and still use the built in Xojo print commands via graphics class:
// get Xojo printer setup dim p as new PrinterSetup // now put it into NSPrintInfo to manipulate dim n as new NSPrintInfoMBS n.SetupString = p.SetupString // change destination to file dim f as FolderItem = SpecialFolder.Desktop.Child("test.pdf") n.SetSaveDestination(f) // move back p.SetupString = n.SetupString // and print as usual dim g as Graphics = OpenPrinter(p) g.DrawString "Hello World", 20, 20
30 09 14 - 10:37
No comments

Remember personal info?

Emoticons / Textile

Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.