Save Xojo report to PDF
// new PDF environment
Dim pdf As New MyDynapdfMBS
// create a new PDF file
Dim f As FolderItem = SpecialFolder.Desktop.Child("report.pdf")
Call pdf.CreateNewPDF(f)
// get graphics for a page
Dim g As Graphics = pdf.PageGraphics
// now get report
Dim rpt As New NameReport
// and a printer setup
Dim ps As New PrinterSetup
// run report
If rpt.Run(PrintableListBox, ps) Then
If rpt.Document <> Nil Then
// let it output to PDF
rpt.Document.Print(g)
End If
End If
// close it
Call pdf.CloseFile
By using PageGraphics as Graphics, you can easily use Xojo's drawing commands for PDF pages and have your application output it's drawing not just to printer, but also to PDF files.
See blog post:
- Create a PDF with PageGraphics and DynaPDF
- Graphics class for DynaPDF
- Xojo reports with backgrounds on PDF
Please do not hesitate to contact us with your questions.