Page 1 of 1

Insert Pagebreak in TRichView

Posted: Thu Aug 02, 2007 3:33 pm
by scchui
I am a newbie evaluating TRichView.

I mainly use TRichView to help me print pictures of the following code:

for i:=1 to 1000 do
begin
jpeg:=tjpegimage.create;
jpeg.LoadFromFile(inttostr(i) + '.jpg');
RichView1.AddPictureEx('', jpeg, -1, rvvaMiddle);
end;
By far I am very satisfied with TRichView to help me insert pictures and print. But I don't know how to insert page break to force a picture to start at a new page. I wonder how I can:
1) Insert pagebreak for a new page;
2) Whether I can determine the distance from a picture to the bottom margin or something like that.

Thanks for any help!

Rgds,
scchui

Posted: Fri Aug 03, 2007 11:12 am
by Sergey Tkachenko
This code adds page break befor the picture:

Code: Select all

...
RichView1.AddPictureEx('', jpeg, -1, rvvaMiddle); 
RichView1.PageBreaksBeforeItems[RichView1.ItemCount-1] := True;
...
Unfortunately, TRichView does not allow to determine this distance (it's only possible, using undocumented methods, when the document is already formatted for printing, i.e. after RVPrint.FormatPages)

Posted: Fri Aug 03, 2007 3:17 pm
by scchui
Thanks, it works!