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

Help on watermark

edited April 2009 in General
Hi,
I need help on print a watermark that must show optionally on every page on
my reports;
This watermark must be printed overall (it's a transparent wmf metafile with
a "fac-simile" curve word);
How I can obtain this easly?
An example is welcome...
Thanks in advance,
Stefano Monterisi

Comments

  • edited April 2009
    Stefano,

    Try placing the image in the Page Style band. This by definition will print
    behide all other report components.

    Activate the Page Style band using the Report menu in the designer.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2009
    Hi Nico,
    thanks for help...but I need to print the watermark on every page (it's a
    composite report) OVER other components;
    Page style draw it UNDER; I have already metafiles with silver background
    (so not transparent) on pages (tax forms) that overlay the "facsimile" word;
    it must be printed ON; In this situation I cannot use page style (that is a
    great feature).
    Can you help me on this?
    Thanks on advance!

    Stefano Monterisi


  • edited April 2009
    Hi Stefano,

    Sorry, I misread your initial post.

    In this case you will need to do something like the following...

    http://www.digital-metaphors.com/rbWiki/Delphi_Code/Formatting/How_To...Manually_Add_a_Watermark_to_a_Page

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2009
    Hi Nico,
    thanks for link;
    code in the demo works perfectly in my report;
    But if I want to draw a metafile instead text, the image don't appear;
    Have you any hint or can provide an example for draw a metafile in the same
    demo?

    Thanks in advance,

    Stefano Monterisi
  • edited April 2009
    Hi Stefano,

    To add an image you will need to use the TppDrawImage drawcommand and assign
    its Picture.Graphic property to the image you would like to display.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2009
    Hi Nico,
    I have changed the CreateWateMmark function, so I have a TppDrawImage
    instead of the original text draw;
    I return it into OnPageEnd where assign the page (unchanged); But the image
    is never displayed; I have trayed also with a simple bitmap instead a
    metafile, without result; There is a property or method of TppDrawImage that
    is mandatory for show the image? (a little working example is welcome) ;
    Thanks in advance!
    Stefano Monterisi


  • edited April 2009
    Hi Stefano,

    The following worked correctly in my testing...

    function TForm1.CreateWaterMarkImage: TppDrawCommand;
    var
    lWaterMark: TppDrawImage;
    llPageHeight: Longint;
    llPageWidth: Longint;
    liImageHeight: Longint;
    liImageWidth: Longint;
    lPrinter: TppPrinter;
    begin

    lWaterMark := TppDrawImage.Create(nil);

    lWaterMark.Picture.LoadFromFile('c:\MyImage.wmf');

    lPrinter := ppReport1.Printer;

    llPageHeight := lPrinter.PrinterSetup.PageDef.mmPrintableHeight;
    llPageWidth := lPrinter.PrinterSetup.PageDef.mmPrintableWidth;
    liImageHeight := lWaterMark.Picture.Height;
    liImageWidth := lWaterMark.Picture.Width;
    lWaterMark.Height := ppToMMThousandths(liImageHeight, utScreenPixels,
    pprtHorizontal, nil);
    lWaterMark.Width := ppToMMThousandths(liImageWidth, utScreenPixels,
    pprtHorizontal, nil);

    lWaterMark.Top := (llPageHeight - lWaterMark.Height) div 2;
    lWaterMark.Left := (llPageWidth - lWaterMark.Width ) div 2;

    Result := lWaterMark;

    end;

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2009
    Hi Nico,
    My code is the same, but I have changed image coordinates with fixed values;
    So, sure the image have wrong dimension and It don't draw correctly (I don't
    see it on the page);
    With the calculation of size and position within the example's code (that is
    the same of previous draw text example) it draw the image;
    Ok, it works and I don't want to change it :-)
    Thank you for help, Nico;
    Any news on Pdf export improvements? (I have forms (metafiles in background
    filled with data) that still don't render correct exporting in Pdf);
    Good Job,
    Best Regards,
    Stefano Monterisi



  • edited April 2009
    Please send an example of these metafiles that do not export correctly to
    support@digital-metaphors.com in .zip format and I'll take a look at them
    for you.

    --
    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.