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

ArchiveReader and Page Count

edited March 2003 in General
Greetings,

I print a report to an archive file and it has 224 pages in it.

Is there anyway to programatically know how many page are contained in an
raf file once it is opened in an archive reader?

Thanks

Mike

--
Michael Tuttle
Software Technologies, Inc.
Topeka, KS

Comments

  • edited March 2003
    Each page object has the AbsolutePageNo property assigned to it when the
    archive is generated. This means you simple need the first page read from
    the archive to know this. If you want to, you can use a TppDevice in code to
    know this before a archive is to be printed, or you can use the device which
    the archive is trying to generate to like this:

    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, ppComm, ppRelatv, ppProd, ppArchiv, StdCtrls;

    type
    TForm1 = class(TForm)
    Button1: TButton;
    ppArchiveReader1: TppArchiveReader;
    procedure Button1Click(Sender: TObject);
    procedure ppArchiveReader1BeforePrint(Sender: TObject);
    private
    procedure PageReceiveEvent(Sender: TObject; aPage: TObject);
    { Private declarations }
    public
    { Public declarations }
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    uses
    ppDevice, ppTypes;

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    ppArchiveReader1.Print;
    end;

    procedure TForm1.ppArchiveReader1BeforePrint(Sender: TObject);
    var
    lDevice: TppDevice;
    begin

    lDevice := ppArchiveReader1.Publisher.Devices[0];
    lDevice.PageRequest.PageSetting := psSinglePage;
    lDevice.PageRequest.PageRequested := 1;
    lDevice.OnPageReceive := PageReceiveEvent;
    lDevice.MakePageRequest;

    end;

    procedure TForm1.PageReceiveEvent(Sender: TObject; aPage: TObject);
    begin
    ShowMessage(IntToStr(TppPage(aPage).AbsolutePageCount));
    end;

    end.

    --
    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.