Activex OLE Delphi

Title: RAVE Export Device for EMF, WMF and Bitmaps
Question: How to implement a generic RAVE render device
Answer:
While developing wPDF V2.10 I came across the problem to
create EMF files from RAVE reporter which ships with Delphi 7 PRO.
The goal was to provide a PDF export filter which renders
embedded metafiles as vectors and also offers a bit more than the
standard PDF export.
Sending a metafile to the wPDF engine would do the task, but how to
get this metafile from RAVE? My search in the manual and
documentation was not quite successful so I found myself digging
in the classes and properties listed in the object explorer.
This took a while, and the result were only a few lines of code.
To create metafiles from RAVE you need to create a device which
inherits from
TRvRenderCanvas
You need to override the
function GetCanvas : TCanvas;
to retrieve the canvas to draw to. For example a metafile canvas.
The procedures DocBegin and DocEnd have to be used to initialize the
output of the document, PageBegin and PageEnd should be used to
initialize and finalize (or save) the current page.
Well - that was is already, except for the functions which calculate
the x and y position. They can be implemented like this:
function TRvRenderGraphic.XI2D(Pos: Double): Integer;
begin
Result := Round(Pos * FResolutionX);
end;
function TRvRenderGraphic.YI2D(Pos: Double): Integer;
begin
Result := Round(Pos * FResolutionY);
end;
I hope this short overview is helpful.
You can download a free EMF and JPEG export device including
full source-code at www.wptools.de (section "Free Stuff").
You can also check out the demo of the universal PDF printing component
wPDF V2.10 which now supports RAVE, RB, QR, FR,
the word processor WPTools (of course), THTMLView, WPForm
and even the Developer Express Printing Suite.
Julian Ziersch
wpCubed GmbH