Use PDF Watermarks |
Top Previous Next |
If the watermark is rather big you can use the PDF watermark feature. You need to create the watermark first to be able to use it. You can do so in OnBeginDoc event to create a set of watermarks first.
procedure TForm1.DoBeginDoc(Sender: TObject); var res : Integer; begin res := Screen.PixelsPerInch; TWPPDFExport(Sender).StartWatermark('water', MulDiv(TWPPDFExport(Sender).Source.Header.PageWidth, res,1440), MulDiv(TWPPDFExport(Sender).Source.Header.PageHeight, res,1440), res, res ); try TWPPDFExport(Sender).DrawGraphicFile(0,0,0,0, 'c:\test.emf' ); finally TWPPDFExport(Sender).EndWatermark; end; end;
In this event we start a watermark page which matches the pages in the RTF editor. You can of course also use the 'Canvas' property to draw the watermark.
This watermark can be easily used in the OnBeforePrintPage event:
procedure TForm1.DoBeforePrintPage(Sender: TObject; Number, FromPos, Length: Integer); begin if TWPPDFExport(Sender).Tag<>0 then begin TWPPDFExport(Sender).UseWatermark('water'); end; end;
|