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

Direct LPT port Printing

edited June 2010 in Devices
Can you print direct to an LPT port with ReportBuilder?

RB 11 Server / Delphi 2007.

Thanks.

Comments

  • edited June 2010
    Hi Jon,

    What exactly are you trying to accomplish? ReportBuilder uses the Windows
    API to communicate with the printer driver which in turn communicates with
    the printer itself. It is possible to manually send ESC commands to the
    printer using the TppPCL class provided in the ppPCL.pas file.

    Perhaps a little more information on your project will help us understand
    how to help.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2010
    Direct printing to the port is to support bar code printers. The ESC
    codes need to go direct to the port without any additional formatting.

    We have done this in the past by using the MODE command to redirect the
    LPT port to the serial port and printing direct to the LPT port where it
    ends up on the serial printer.

    Using the windows print driver bypasses the mode command redirect.


  • edited July 2010

    RB 11 introduced support for sending printer commands directly to the
    printer. Windows calls these escape commands.

    The Printer.SendEscape method can be called from the
    Report.OnDeviceStateChange event. And a TppPCL command library includes
    simple to use commands. Example:

    myPrinter.SendEscape(TppPCL.JobControl.Copies(3))


    The Report.OnPrinterDeviceStateChange event fires while sending pages to the
    printer.

    uses
    ppTypes;

    procedure Form1.ppReport1OnPrinterDeviceStateChange(Sender: TObject;
    aStateChange: TppDeviceStateChangeType);
    begin
    if (aStateChange = dsAfterStartPage) then
    ppReport1.Printer.SendEscape('some escape code here');

    end;


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.