We are integrating DynaPDF with the Graphics class in Xojo. You can get a graphics object to draw into the current page via normal graphics class methods. The code looks like this:
Dim g as graphics = pdf.PageGraphics
Technically we create a temporary picture with a subclassed graphics class and give you the graphics object from the picture. You can get the temporary picture with PageGraphicsPicture property. All draws go both into the picture and the PDF page:?
Dim p as picture = pdf.PageGraphicsPicture?
We support normal drawing commands in graphics class and the usual properties. Draw/Fill Oval/Rect/RoundRect/Line/Polygon will just work. DrawString draws text for single and multi line. StringHeight and StringWidth measure text via DynaPDF functions, so the result may be different than in a picture, but you get the right values needed for the PDF output. DrawPicture can draw picture with alpha channel and masks if needed. NextPage method will close current page and make a new one. Or you implement NextPage event to do this yourself. Then you can import existing page as background.
We support vector graphics classes (Object2D) and drawObject command. Most properties should work and this includes transparency and rotation.
As the report engine is built on Object2D, the report engine can output to PDF via our graphics class.
This works in all Xojo versions (And Real Studio), with all DynaPDF editions and come soon with next 19.2 prerelease.
// close page and file
Call pdf.EndPage
Call pdf.CloseFile
// for in-memory PDF, use GetBuffer here to grab it.
'Dim PDFData As String = pdf.GetBuffer[/code]
You can put the actual drawing code into a method with g as graphics parameter and than call it on several places. e.g. call it from Canvas.Paint event to show it in a window, call it with graphics from OpenPrinterDialog to draw in printing context or call it with PageGraphics to draw into a PDF document.