Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Print a report to multiple devices during the same printjob?

edited December 2004 in General
Hi,

Is it possible to print a report to a 'dtScreen/dtPrinter' device and a
'dtArchive' device during the same printjob. Consider a report contains 3
pages. When done printing page 1, page 1 is printed to archive, when done
printing page 2, page 2 is printed to archive,... Is this possible or do we
have to print the report twice, first time to the 'dtScreen/dtPrinter'
device and after that print each page to the 'dtArchive'?

Greetings,
Filip Moons

Comments

  • edited December 2004
    Hi Filip,

    Check out Demo 122 (dm0122.pas) located in the \RBuilder\Demos\1.
    Reports\... directory. This example shows how to print to multiple devices
    at a time. The multiple devices are two printer devices but you will need
    to use the same concepts for your app.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2004
    Hi Nico,

    For testing purposes i'm trying to print a report to a screen, printer and
    archive device.
    - It only prints to the screen (Designtime reports DeviceType)
    - How do i show printdialog when printed to TppPrinterDevice
    - Is it possible to sent each page to a different file when printed to
    TppArchiveDevice

    Greetings,
    Filip


    procedure TForm2.Button3Click(Sender: TObject);
    var
    Indx: Integer;
    APrintDevice: TppPrinterDevice;
    AScreenDevice: TppScreenDevice;
    AnArchiveDevice : TppArchiveDevice;
    APrintDeviceList: TList;
    begin
    APrintDeviceList := TList.Create;
    try
    // Printer
    ppReport1.ShowPrintDialog := True;
    ppReport1.DeviceType := dtPrinter;
    APrintDevice := TppPrinterDevice.Create(Nil);
    APrintDevice.Publisher := ppReport1.Publisher;
    APrintDeviceList.Add(APrintDevice);
    // Screen
    ppReport1.ShowPrintDialog := False;
    ppReport1.DeviceType := dtScreen;
    AScreenDevice := TppScreenDevice.Create(Nil);
    AScreenDevice.Publisher := ppReport1.Publisher;
    APrintDeviceList.Add(AScreenDevice);
    // Archive
    ppReport1.ShowPrintDialog := False;
    ppReport1.DeviceType := dtArchive;
    AnArchiveDevice := TppArchiveDevice.Create(Nil);
    AnArchiveDevice.Publisher := ppReport1.Publisher;
    AnArchiveDevice.PageSetting := psAll;
    AnArchiveDevice.FileName := 'Report123.RAF';
    APrintDeviceList.Add(AnArchiveDevice);
    ppReport1.PrintToDevices;
    finally
    for Indx := Pred(APrintDeviceList.Count) downto 0 do
    TObject(APrintDeviceList[Indx]).Free;
    APrintDeviceList.Clear;
    FreeAndNil(APrintDeviceList);
    end;
    end;


This discussion has been closed.