PDF page of x pages AdvGridPDFIO

I need the "1 of 3" page display on the PDF that was created by
AdvStringGrid --> TAdvGridPDFIO.

So if my PDF consists of 3 pages, the first page should show 1 of 3, the second page 2 of 3 and the third page 3 of 3.

My approach was:

tRowHeight = Row height stringgrid

    tAzRowSite := AdvGridPDFIO.PageHeight - AdvGridPDFIO.Options.Margins.Top - AdvGridPDFIO.Options.Margins.Bottom) div tRowHeight;
    tmAnzPage := Trunc((AdvStringGrid.RowCount+1) / tAzRowSite) + 1;

When I measure the whole thing in the finished PDF, the Rowheight = 20 and the page height 1153.
and it has 57 lines

The page height shown with AdvGridPDFIO.PageHeight queried is 842
the margins are each 40
rowheight is 18
with my calculation this results in 42 (.33333) lines

Is there another solution that provides the correct result?
I could also create the PDF two times and remember the max page. But that's not so cool.

Unfortunately it's not possible to calculate the number of pages it needs. We'll investigate the possibilities

Ok

Has a solution been found yet?

Hi,

We’ve added support for adding a pdf page count reference, that will automatically be filled in with the count. For example in demo 92 demonstrating AdvGridPDFIO, changing the code from

procedure TForm56.AdvGridPDFIO1GetFooter(Sender, AExportObject: TObject;
  APageIndex: Integer; var AFooter: string);
begin
  AFooter := 'Page ' + IntToStr(APageIndex + 1);
end;

to

uses
  AdvPDFCoreLibBase;

procedure TForm56.AdvGridPDFIO1GetFooter(Sender, AExportObject: TObject;
  APageIndex: Integer; var AFooter: string);
begin
  AFooter := 'Page ' + IntToStr(APageIndex + 1) + ' of ' + PDFPageCountRef;
end;

will result in:

Note that we still need to release this improvement so the next version of TMS VCL UI Pack will have this included.