Events

Top  Previous  Next

OnError(Sender: TObject; num: Integer; text: string)

 

This event is triggered if an error occurs. This error can be an exception the export DLL or a warning that a used book mark was not defined by the time the PDF export was finalized. In property "ExtraMessages" you can select wpOnEmbedFonts to get an event each time a font is embedded.

 

The following error numbers are defined:

 

ERR_BOOK = 1

A bookmark cannot be found.

 

ERR_BITM = 2

A bitmap cannot be embedded properly. It might be corrupt or compressed.

 

ERR_FILE = 3

The file is write protected.

 

ERR_META = 4

The metafile is not compatible.

 

ERR_FONT = 5

We tried to embed a font and failed.

 

ERR_IMPORT = 6

It was not possible to import the input PDF file. (It cannot be encrypted or LZW compressed)

 

ERR_MsgEmbedFont = 10

A font was embedded. (Not an error)

 

 

BeforeBeginDoc(Sender: TObject)

 

This event is created before the PDF file has been created. It is the last chance to modify certain parameters such as the "info" properties.

 

AfterBeginDoc(Sender: TObject)

 

This event is triggered right after the PDF file has been opened. It is the first chance to create a page, export metafiles or create an outline.

 

BeforeEndDoc(Sender: TObject)

 

This event is triggered before the PDF file has been closed. It is the last chance to create a page, export metafiles or create an outline.

 

AfterEndDoc(Sender: TObject)

 

This event is triggered when the PDF file or stream has been completed.

 

 

The TWPPDFExport class (for export from WPTools) also offers:

 

OnBeforePrintPage(Sender: TObject; Number, FromPos, Length: Integer)

 

This event makes it possible to create a watermark for each or some selected exported pages. Examples.

 

OnAfterPrintPage(Sender: TObject; Number, FromPos, Length: Integer)

This event makes it possible to draw over each or some of the exported pages.

 

OnPrintObject(Sender: TWPCustomPDFExport;

     Memo : TWPRTFTextPaint;

     PObj : PTTextObj;

     Obj  : TWPObject;

     R    : TRect;

     var Abort : Boolean)

 

This event will only work when you are using WPTools 4.09e or later. It is triggered for each exported embedded TWPObject object. You get a pointer to the reference, the object and the rectangle where it should be drawn to. If you set "Abort" to true the default code is not executed. This is useful if you want to export the object (or any replacement data) yourself.

To do so you can use

 

   Sender.Canvas.StretchDraw(R, Your_Graphic);

   Abort := TRUE;