GDIComment |
Top Previous Next |
GDIComments can be used to control the PDF engine. The comment data is inserted into the stream of graphical commands and ca so be executed in the context of different modifications to the graphic system, such as scaling or clipping.
This methods can export bitmap data using GDIComments when the optional parameter OnCanvasMode ist true.DrawPNGFile, DrawPNG and DrawJPG
To add GDI comments this methods can be used: procedure WriteGDIComment(Comm: Integer; const r: TRect; data: PAnsiChar; datalen: Integer);
procedure WriteGDICommentStr(Comm: Integer; const r: TRect; text : AnsiString);
procedure WriteGDICommentStr(Comm: Integer; const r: TRect; utext: UnicodeString); overload;
In all cases a command ID "Comm" and a rectangle is exported. Optionally extra data can be added.
You can also use this code to create a GDIComment in your own code which can be compiled independently of wPDF.
procedure WPWriteGDIComment( Handle : HDC; Comm: Integer; const r: TRect; data: PAnsiChar; datalen: Integer); type PWPComRec = ^TWPComRec; TWPComRec = packed record a: Integer; b: Integer; c: TRect; d: Integer; end; var p: PWPComRec; pp: PAnsiChar; begin GetMem(p, SizeOf(TWPComRec) + datalen); try FillChar(p^, SizeOf(TWPComRec) + datalen, 0); p^.b := 120269; p^.a := comm; p^.c := r; if datalen > 0 then begin pp := PAnsiChar(p); inc(pp, SizeOf(TWPComRec)); Move(data^, pp^, datalen); p^.d := datalen; end; GdiComment(Handle, SizeOf(TWPComRec) + datalen, PAnsiChar(p)); finally FreeMem(p); end; end; |