Getting HBITMAP from TControlCanvas
Posted on 2004-04-28
I am using the Adobe AcroExch OLE interface to extract page images of a PDF document using the PDPAGE.CopyToClipboard function. The clipboard bitmap is then converted to a TIF file using a third party graphics library.
This works fine but is painfully slow at approximately 1 page per 3 seconds. We have over 1,000,000 pages to convert.
I have another utility, XPDFRasterizer, that is ten times faster that AcroExch but it has a problem with rendering Adobe Master Fonts so I have had to abandon it.
However, I have done some tests using the AcroExch DrawEx function instead of CopyToClipboard and it is also very fast. However, it only works by drawing the PDF page bitmap onto a TForm.Canvas.
The graphics library requires 2 parameters, HBITMAP, HPALETTE or HDC. My problem is to get a HBITMAP from TForm.Canvas without doing a CopyRect.