Page 1 of 1

ScaleRichview Page Number

Posted: Sun Feb 23, 2020 5:22 am
by pgkammath
The SRichViewEdit is generating the Page number by setting the PageProperty PageNoVisible to True (Default).
I want to print the number as 1/5, 2/5,..... like that. I looked at the examples
here , Trichview\TRichView\Demos\Delphi\Assorted\Printing\Printing

The OnpagePrepaint is seen from RvPrint but not for SrvPrint.
Not able to find the right one.
Please help.

Re: ScaleRichview Page Number

Posted: Sun Feb 23, 2020 8:52 am
by Sergey Tkachenko
The recommended way is using header of footer to insert "page number" and "page count" fields.
If you use RichViewActions, you can use TrvActionInsertPageNumber and TrvActionInsertPageCount commands (menu "Insert | Page Number" and "Insert | Page Count").
If you want to do it in code, insert TRVPageNumberItemInfo and TRVPageCountItemInfo (if you need a code sample, let me know).



If you want to draw on a page, use OnPaintPage event. See the demo <TRichView Dir>\ScaleRichView\Demos\Delphi\CustomDraw\Header and Footer\ ).

Re: ScaleRichview Page Number

Posted: Sun Feb 23, 2020 12:04 pm
by pgkammath
Dear Sergey,
Thanks for the prompt reply. A Code sample for scalerichview would be much appreciated. I am using the header now. The Scalerichview prints the page number at the bottom of the page by default. An sample code to implement this in scalerichview will be very helpful.


I tried this,
nPageNo := TRVPageNumberItemInfo.Create(FinalData.RichViewEdit.RVData);
nPageCount := TRVPageCountItemInfo.Create(FinalData.RichViewEdit.RVData);


FinalData.Subdocuments[srvhftNormalHeader].AddItem('%d',[nPageNo],0,0);

I am confused about getting the PageCount in page of / pagecount

..
..
..
nPageNo.free
nPageCount.Free;

Thanks in advance.

Regards,