Question
“How do I print my report backwards from last page to first?”
Solution
Start by caching the pages to memory. Next rearrange the pages as you need by manually starting and ending the print job using the TppDevice.StartJob and TppDevice.EndJob routines.
Download: PrintReportBackwards.zip
Sample Delphi code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
var liIndex: Integer; lDevice: TppDevice; lPrinterDevice: TppPrinterDevice; lPage: TppPage; begin lDevice := TppDevice.Create(nil); lDevice.PageSetting := psAll; lDevice.Publisher := ppReport1.Publisher; ppReport1.CachePages := True; ppReport1.PrintToDevices; lPrinterDevice := TppPrinterDevice.Create(nil); lPrinterDevice.Printer.PrinterSetup.Assign(ppReport1.PrinterSetup); lPrinterDevice.StartJob; for liIndex := ppReport1.Publisher.PageCount - 1 downto 0 do begin lPage := ppReport1.Publisher.Pages[liIndex]; lPrinterDevice.ReceivePage(lPage); end; lPrinterDevice.EndJob; lDevice.Free; lPrinterDevice.Free; end; |