trichview.com

trichview.support.examples




Example: printing chosen pages


Return to index


Author

Message

Sergey Tkachenko

Posted: 03/14/2004 13:02:46


There are two RVPrint's methods for printing:

- Print - prints all pages;

- PrintPages - prints the specified range of pages.


But what if you need to print several pages not belonging to a continuous

range, for example 1, 3, 4, 5, 23?

Of course, you can call PrintPages several times, but this will create

several printing jobs.


The procedure below solves this problem:


procedure PrintSomePages(const Title: String;

  RVPrint: TRVPrint; const Pages: array of Integer);

var i: Integer;

begin

  Printer.Title := Title;

  Printer.BeginDoc;

  for i := Low(Pages) to High(Pages) do begin

    if i<>Low(Pages) then

      Printer.NewPage;

    RVPrint.rv.DrawPage(Pages[i], Printer.Canvas,False,False);

  end;

  Printer.EndDoc;

end;


Test:


PrintSomePages('Test', RVPrint1, [1, 3, 4, 5, 23]);


Of course, RVPrint must be formatted (FormatPages) and must have at least 23

pages for this example.





Powered by ABC Amber Outlook Express Converter