#1 2013-09-19 11:27:11

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

TGDIPages footer page numbers

I want to create a report which is a concatenation of other reports and get the footer page numbering as shown in the original concatenated report ('Page #/#'). It doesn't seem that easy to do. Would one way be to add two private TIntegerDynArray variables to TGDIPages which parallel fPages in size? A 'ResetPageCount' function could be added to manage these new variables and then when EndDoc is called they would be used to build the footer page number text.

Offline

#2 2013-09-19 11:37:09

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

Re: TGDIPages footer page numbers

Report merging is indeed not part of the current class implementation...

Is it not possible to use the same TGdiPages instance for all sub-reports?

Offline

#3 2013-09-19 16:23:41

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Re: TGDIPages footer page numbers

What I'm aiming for is a PDF with a set of reports with their original page numbers. Would it be possible to use

property Pages: TGDIPageContentDynArray read fPages;

to copy between two TGDIPages which are created at the same time. One would make all the sub-reports and the other would copy these as they are made and create a combined report at the end?

Offline

#4 2013-09-19 19:26:55

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

Re: TGDIPages footer page numbers

You can use this array to access all pages metafiles and render them in one PDF.

Offline

#5 2013-09-30 11:43:25

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Re: TGDIPages footer page numbers

Could TGDIPages.SetMetaFileForPage and getMetaFileForPage be given public scope. Then I can simply do something like:

for i := 0 to NumberOfReports do
  //make report...
  report.EndDoc;
  for ii := 0 to report.PageCount -1 do begin
    MergedReport.NewPage;
    MergedReport.SetMetaFileForPage(MergedReport.PageCount-2, report.GetMetaFileForPage(ii));
  end;
end;

It's not perfect because NewPage flushes the last page overwriting the content. As a workaround the Merged report has one more page than needed and gets the penultimate page written to.

Offline

#6 2013-09-30 11:54:03

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

Re: TGDIPages footer page numbers

IMHO this is much better to do it at PDF generation level, not creating any main TGdiPages report.

Offline

#7 2013-09-30 12:04:07

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Re: TGDIPages footer page numbers

OK, I'll try and do something along the lines of ExportPDFStream.

Offline

#8 2013-10-01 05:24:33

esmondb
Member
From: London
Registered: 2010-07-20
Posts: 299

Re: TGDIPages footer page numbers

Thanks for the help. I've worked out how to do it smile

Offline

Board footer

Powered by FluxBB