« MBS Xojo Plugins, ver… | Home | MBS Xojo Plugins, ver… »

Save Xojo report to PDF


If you use Xojo reporting and you like to output them to a PDF, get the MBS Xojo DynaPDF Plugin, currently in the OmegaBundle 2020 to implement this feature in your application:

// 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: Code above is intentionally kept brief as all error checking is skipped. If used in real world, you may need to check e.g. if CreateNewPDF returns an error as the file could not be created.

Please do not hesitate to contact us with your questions. The biggest plugin in space...
17 07 20 - 10:35