Tip of day: Save Xojo report to PDF
Dim ds As New GasDataSet
Dim ps As New PrinterSetup
Dim rpt As New GasPricesReport 'this is a report editor project item
'set the resolution to 300 DPI for printing
ps.MaxHorizontalResolution = 300
ps.MaxVerticalResolution = 300
// change PrinterSetup to point to print to PDF file
dim s as new NSPrintInfoMBS
s.SetupString = ps.SetupString
s.SetSaveDestination SpecialFolder.Desktop.Child("test.pdf")
ps.SetupString = s.SetupString
// now print report
Dim g As Graphics = OpenPrinter(ps)
If g <> Nil Then
If rpt.Run( ds, ps ) Then 'if the report runs successfully
rpt.Document.Print(g)
End If
End If
As you see we use the NSPrintInfoMBS class to manipulate PrinterSetup's setupString to target the PDF file. The code above is from the modified Gas Reports example coming with Xojo.
