#1 2012-02-22 12:03:25

josefkoller
Member
Registered: 2012-02-22
Posts: 11

Picture in header or footer

Hello,

first I found your PDF engine via forum search and .... it's great. You do a great job. Thank you.

Now my question:
Is it possible to place a picture into header or footer section?

Is there anywhere a piece of code?

Thanks

Josef

Offline

#2 2012-02-22 13:00:39

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,243
Website

Re: Picture in header or footer

You may have made a quick search in this forum... this question was asked just a few days ago...
wink

See http://synopse.info/forum/viewtopic.php?id=598

If you want it at the "raw" SynPDF level (not using TGdiPages class), you have to do it by hand, drawing it on every page.

Thanks for the interest!

Offline

#3 2012-02-22 14:31:02

josefkoller
Member
Registered: 2012-02-22
Posts: 11

Re: Picture in header or footer

Thanks for answer.

But till now I found no way to place my picture in the headsection.

Do you have some code for my click procedure to realize my picture.

Here my click procedure:

procedure TfUebersichtzuchtkalender.BTzuchtkaldruckClick(Sender: TObject);
var bmp:TBitmap;
begin
  with TGDIPages.Create(self) do
  try

    bmp:=tBitmap.Create;
    bmp.LoadFromFile('C:\Bauplan\auftrag.bmp');

    // the title of the report
    Caption := 'Zuchtkalender';
    // now we add some content to the report
    BeginDoc;

    .....


thanks

Josef

Offline

#4 2012-02-22 18:38:57

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,243
Website

Re: Picture in header or footer

You have to set OnStartPageHeader and OnEndPageHeader event handlers of the TGDIPages instance with your own methods.

procedure MyReportHeader(Sender: TObject);
var Report: TGdiPages;
begin
  Report := Sender as TGdiPages;
  Report.DrawBMP(....);
end;

......
   with TGdiPages.Create(self) do
   try
     OnStartPageHeader := MyReportHeader;
....

 
Hope it helps.

Offline

#5 2012-02-22 20:08:50

josefkoller
Member
Registered: 2012-02-22
Posts: 11

Re: Picture in header or footer

Hello,

thanks for the example code. Now it works.

I have had problems with the correct sender declaration:

procedure MyReportHeader(Sender: TObject); //I thought the right one is TGdiPages

Thanks

Josef

Offline

Board footer

Powered by FluxBB