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

Is it possible to Print Individual Copies to different Printers using RAP ?

edited April 2003 in RAP
Delphi 6.02 Pro
RB 7.01 Ent.
Windows 2000 SP2
MS Access Database (ADO)

A customer has requested the ability to print individual copies to separate
printers i.e. an Invoice Report is set to print 2 copies, they want 1 copy
to print on the Accounts Office printer the other copy to print on the Sales
Office Printer. Is this possible to do using RAP, if so how ?

Cheers

Stuart

Comments

  • edited April 2003
    Create a custom print dialog. This will let them choose one of the available
    printers for each copy. Then print the copies in code. You may get some
    ideas from this example and use its technique to use PrintToDevices to print
    each copy manually.

    http://www.digital-metaphors.com/tips/BreakCopiesIntoJobs.zip


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited April 2003
    Thanks for the help Jim.

    For anyone else interested I have posted some sample code below which works
    for me.

    procedure TForm1.Button1Click(Sender: TObject);
    var
    lPrinterDevice: TppPrinterDevice;
    lPrinterDevice2: TppPrinterDevice;
    begin

    // Create printer devices for each copy to be printed
    lPrinterDevice := TppPrinterDevice.Create(Self);
    lPrinterDevice.Stackable := True;

    lPrinterDevice2 := TppPrinterDevice.Create(Self);
    lPrinterDevice2.Stackable := True;

    Try

    // Set Printer to be used by each Device
    if lPrinterDevice.Printer <> nil then
    lPrinterDevice.Printer.PrinterSetup.PrinterName := 'Lexmark Z42 Series
    ColorFine';

    if lPrinterDevice2.Printer <> nil then
    lPrinterDevice2.Printer.PrinterSetup.PrinterName := 'Epson FX-100+';

    // Force the No. of Copies to 1 for each Device
    lPrinterDevice.Printer.PrinterSetup.Copies := 1;
    lPrinterDevice2.Printer.PrinterSetup.Copies := 1;

    // Print First Copy
    ppReport1.PrinterSetup.PrinterName :=
    lPrinterDevice.Printer.PrinterSetup.PrinterName;

    lPrinterDevice.StartPrintJob := True;
    lPrinterDevice.EndPrintJob := False;
    lPrinterDevice.Publisher := ppReport1.Publisher;

    ppReport1.PrintToDevices;

    // Print Second Copy
    ppReport1.PrinterSetup.PrinterName :=
    lPrinterDevice2.Printer.PrinterSetup.PrinterName;

    lPrinterDevice2.StartPrintJob := True;
    lPrinterDevice2.EndPrintJob := False;
    lPrinterDevice2.Publisher := ppReport1.Publisher;

    ppReport1.PrintToDevices;

    Finally

    lPrinterDevice.Free;
    lPrinterDevice2.Free;

    end;
    end;

    Cheers

    Stuart


This discussion has been closed.