How to add Watermark to each copie pages ?

Hello,

I'm printing labels (2*8) sheets. All labels does have unique QR Codes.
My customer needs to have copies of these sheets (1 label stuck Outside the product, another one stuck inside the product).

I want to add watermarks to all copy pages. How can I do this ?

Thank you

B.R.

St?©phane WIERZBICKI

Comments

  • gpigpi
    edited 4:38PM
    You can add watermark in the TfrxReport.OnEndDoc
    procedure TForm1.frxReport1EndDoc(Sender: TObject);
    var p: TfrxReportPage;
    m: TfrxMemoView;
    i: integer;
    begin
    frxReport1.Preview.Lock;
    for i := 0 to frxReport1.PreviewPages.Count - 1 do
    begin
    p:=TfrxReportPage(frxReport1.PreviewPages.Page[i]);
    m:=TfrxMemoView.Create(p);
    m.CreateUniqueName;
    m.SetBounds(0, 0, (p.PaperWidth - p.RightMargin - p.LeftMargin) * fr01cm, (p.PaperHeight - p.TopMargin - p.BottomMargin) * fr01cm);
    m.Text := 'Demo';
    m.Rotation := 45;
    m.Font.Size := 128;
    m.VAlign := vaCenter;
    m.HAlign := haCenter;
    frxReport1.PreviewPages.ModifyPage(i,p);
    end;
    frxReport1.Preview.UnLock;
    end;
    

    or before page's printing in the TfrxReport.OnPrintPage
    procedure TForm1.frxReport1PrintPage(Page: TfrxReportPage;
    CopyNo: Integer);
    var m: TfrxMemoView;
    begin
    m:=TfrxMemoView.Create(page);
    m.CreateUniqueName;
    m.SetBounds(0, 0, (page.PaperWidth - page.RightMargin - page.LeftMargin) * fr01cm, (page.PaperHeight - page.TopMargin - page.BottomMargin) * fr01cm);
    m.Text := 'Demo';
    m.Rotation := 45;
    m.Font.Size := 128;
    m.VAlign := vaCenter;
    m.HAlign := haCenter;
    end;
    
  • For me this only works when commenting out these lines:

    frxReportInternal.Preview.Lock;

    frxReportInternal.Preview.UnLock;

    Otherwise it crashes in the .Lock line.

    This is FastReports 6.x Embarcadero edition in 10.4.2. The report is on a data module but preview works as expected when these lines are commented out.

    Any clue why this crashes with an access violation?

    Exception of class $C0000005 with message 'access violation at 0x00b3c969: read of address 0x00000000' occurred.

  • And how to get the memo to the background instead of the foreground?

Leave a Comment