How to compose a document from multiple documents?

ScaleRichView support and discussion (TRichView add-on for WYSIWYG editing)
Post Reply
Stefaan
Posts: 30
Joined: Mon Feb 16, 2009 11:36 am

How to compose a document from multiple documents?

Post by Stefaan »

I have a document with fields, that must be replaced with values. Several documents will be created by using different values. All these documents should come in a large document, with each document beginning on a new page. This resulting document must be shown in a print preview and be printed. What is the best way to create such composite document?

There's a demo on that topic on http://www.trichview.com/forums/viewtopic.php?t=87 but its targeted at TRichViewEdit and TRVPrint. I'm using TSRichViewEdit and TSRVPrint.
Sergey Tkachenko
Site Admin
Posts: 17520
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Use TSRVPrint to print several documents on one printing job.
TSRVPrint.PrintFramesEx prints one page.

Code: Select all

var FirstPage: Boolean;

FirstPage := True;
Printer.BeginDoc;
for i := 0 to DocumentCount-1 do begin
  <prepare the i-th document here>
  for j := 1 to SRichViewEdit.PageCount do begin
    if FirstPage then 
      FirstPage := False
    else
      Printer.NewPage;
    SRVPrint1.PrintFramesEx(j);
  end;
Printer.EndDoc;
Stefaan
Posts: 30
Joined: Mon Feb 16, 2009 11:36 am

Post by Stefaan »

Thanks for your answer. Is it possible to show a print preview of the composite document to the user before printing?
proxy3d
ScaleRichView Developer
Posts: 307
Joined: Mon Aug 07, 2006 9:37 am

Post by proxy3d »

Yes. For this purpose you need to display pages. For page drawing, it is necessary to use function:

Code: Select all

    procedure DrawPage(PageNo, PageWd, PageHt, OffX, OffY: Integer;
      CanvasPage: TCanvas; PageNoVisible, ClipMargins, Printing: Boolean);
Description of parametres of function look in the help.
Post Reply