Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

watermark

edited November 2007 in General
Hello all,

I want to print a pdf file with a watermark. I have already a report
printing and want to add this watermark at runtime. The watermark is an
image (jpeg) with the size of a A4 paper.

what i alrready have is TExtraDevice to export to a pdf file. So the only
thing i want is to add a watermark in the beforeprint event or something
like that. I've searched already and found some different solutions but i
can't find out which one is the best to use.

First is to use the page style band and create an image on it.

Second is to use the TppDrawImage class (i think) and use it like the
AddWaterMark routine in ppViewr.pas.

I can't get both options get to work. What wil work is to dynamically add a
TppImage to the titleband, but i would like a watermark with the size of an
A4 paper, and use it like a watermark.

Can someone help me?

Thanks in advance.

Wim Looman
Hills automatisering B.V.

Comments

  • edited November 2007
    Hi Wim,

    The easiest way to add a watermark to a report is to add it to the PageStyle
    band and toggle its visibility based on where the report is printing.
    Before the report prints, simply create a new TppImage object and assign it
    to the PageStyle band. Something like the following...

    uses ppCtrls, ppBands;

    ...

    FPageStyle := TppPageStyle.Create(Self);
    FPageStyle.Report := ppReport1;

    lImage := TppImage.Create(Self);
    lImage.Band := FPageStyle;
    lImage.Left := 0;
    lImage.Top := 0;
    lImage.Width := ppReport1.PrinterSetup.PrintableWidth;
    lImage.Height := ppReport1.PrinterSetup.PrintableHeight;
    lImage.Stretch := True;

    lImage.Picture.LoadFromFile('myImage.bmp');

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.