I needed an easy way to create xplat PDF files … and looked at various plugins, classes etc that others have made available for Xojo, and either the cost was too expensive in relation to the project, or they were too complex to just “drop in”.
SOOOOO… that being said. I have begun development of a “Simple PDF” class. This class will be an almost 100% drop in replacement for a Printer Graphics Object. To the point where the properties and methods are IDENTICAL, with the exception of TWO… the constructor accepts more parameters, mostly to compensate for the fact there is no Printer Dialog involved or needed… and a NEW method called SavePDF which places the results in an external file.
Currently I have DRAWLINE, DRAWRECT, DRAWOVAL, DRAWPOLYGON,FILLRECT, FILLOVAL, FILLPOLYGON, FORECOLOR, PENWIDTH, NEXTPAGE,HEIGHT and WIDTH all working (not bad considering I started work on this about 8 hours ago )
Still to do is DRAWPICTURE, DRAWOBJECT, DRAWROUNDRECT, FILLROUNDRECT, DRAWSTRING, TEXTHEIGHT,TEXTASCENT,STRINGHEIGHT,TEXTASCENT (ie… all of the “text stuff” mostly)
simple example of its use
dim pdf as new classGRAPHICS_PDF
pdf.ForeColor=&cff0000
pdf.PenWidth=5
pdf.DrawLine 10,10,1000,1000
pdf.NextPage
pdf.drawrect 100,100,200,200
pdf.drawoval 100,100,200,200
pdf.ClearRect 150,150,200,200
pdf.SavePDF(SpecialFolder.Desktop.child("x.pdf"))
So far only one tiny drawback… The PDF file it creates is not compressed… but hey I haven’t gotten to version 2 yet