Hello all,
I am working on a huge (Unicode-enabled) application that produces very detailed graphic output and I want to give it PDF support without resorting to a PDF printer driver such as Adobe Acrobat. My application generates so much graphic output that, for speed reasons, it uses Windows GDI commands rather than the methods wrapped by Delphi's tCanvas object.
So, from a Delphi point of view, I grab the HDC wrapped by the Tcanvas.Handle property and do all my painting using GDI. My application works well with any Windows GDI device, and it also works problem-free with the Adobe Acrobat printer driver. I am currently evaluating several PDF libraries, including wpdf, that support tcanvas/hdc, hoping to be able
to use the best candidate as a drop-in replacement for Acrobat.
So far during my test of Wppdf I am encountering some unexpected problems and even crashes.
Problem 1: text not getting printed.
This is my biggest problem. For some reason, a lot of text produced by my application (using TextOutW) does not get printed, whereas it prints perfectly on all other GDI devices. Maybe it has to do with the way I create fonts (GDI:createfontindirect)?
Problem 2: pdf.CidFontMode=WPCidUnicode produces GPF's
My application supports unicode. Setting property "pdf.CidFontMode" to "wpCIDUnicode" results in GPF's while printing. I had to set it to wpcidoff to prevent that - must be a bug.
Problem 3: LineTo() appears to draw endpoints too.
This is only a minor problem: Upon closer examination of the output, it appears that lines drawn using the GDI Method LineTo() are drawn including their endpoints. GDI devices should exclude the end points.
Problem 4: Resolution of Wppdfprinter HDC is difficult to set
My next problem is obtaining a sensible resolution. I need at least 300 REAL dpi's, better even would be 600 dpi. If property "pdf.canvasreference" has its default value WpRefScreen, that gives me a resolution of only 96 dpi. Explicitly specifying 300 dpi in pdf.startpage does give me a logical coordinate system of 300 dpi, but the accuracy "on paper" appears to be still only 96 dpi so that doesn't really help.
Setting property "pdf.canvasreference" to wpRefPrinter gives much better results, but specifying any other resolution than 600 dpi (which happens to be the resolution of my default printer) results in partly empty pages (GDI objects not being drawn). The only resolution that kinda works is 600 dpi. The end user of my product may have different hardware, so how do I obtain the dpi that works for him or her?