Question
“How do I add items to an archived page before viewing or printing with the Archive Reader?”
Solution
Create a generic TppRasterDevice and implement its OnPageReceive event to add a drawcommand to the page before the report is rendered.
Download: ArchiveReaderAddDrawCommand.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 |
procedure TForm1.ppArchiveReader1BeforePrint(Sender: TObject); var lDevice: TppDevice; begin // get reference to the screen or printer device if (ppArchiveReader1.PrinterDevice <> nil) then lDevice := ppArchiveReader1.PrinterDevice else if (ppArchiveReader1.PreviewForm <> nil) then lDevice := TppViewer(ppArchiveReader1.PreviewForm.Viewer).ScreenDevice else lDevice := nil; // attach handler to device OnPageReceive event if (lDevice <> nil) then lDevice.OnPageReceive := ehPageReceive; end; procedure TForm1.ehPageReceive(Sender, aPage: TObject); begin // add draw command to page (see example for implementation AddDrawCommand(TppPage(aPage)); end; |