Send ESC/POS commands to the printer
Hi!
I'm using ReportBuilder Pro 11 + Delphi 7 Pro.
Some customers are asking about sending Epson commands to the printer,
because printing through the driver is slower than printing using ESC/POS
commands with some printers (Parallel or Serial printers).
For example: printing Logos, text adjusting, etc...
USB and new printer models print very fast using ReportBuilder. No matter
what you want to print.
But some parallel/serial printers print too slow, so the solution is using
'Generic/Text Only' driver or printing through the printer Port directly.
Does anybody know or have an example of how to send ESC/POS commands to the
printer using ReportBuilder? Is there any ThirdParty device available? Any
trick? Is anybody having the same problem? Is it possible to convert
'127,0,28,255' to something like '^p^t^100' that could be recognized by the
printer?
Thanks!
--
Luis C.
I'm using ReportBuilder Pro 11 + Delphi 7 Pro.
Some customers are asking about sending Epson commands to the printer,
because printing through the driver is slower than printing using ESC/POS
commands with some printers (Parallel or Serial printers).
For example: printing Logos, text adjusting, etc...
USB and new printer models print very fast using ReportBuilder. No matter
what you want to print.
But some parallel/serial printers print too slow, so the solution is using
'Generic/Text Only' driver or printing through the printer Port directly.
Does anybody know or have an example of how to send ESC/POS commands to the
printer using ReportBuilder? Is there any ThirdParty device available? Any
trick? Is anybody having the same problem? Is it possible to convert
'127,0,28,255' to something like '^p^t^100' that could be recognized by the
printer?
Thanks!
--
Luis C.
This discussion has been closed.
Comments
RB 11 includes
1. new TppPrinter.SendEscape method that can be used to send escape commands
directly to the printer.
2. new TppReport.OnPrinterDeviceStateChange event that fires during
printing. An aStateChange parameter is passed to the event-handler. The
aStateChange parameter is of type TppDeviceStateType and is defined in
ppTypes.
TppDeviceStateType = (dsBeforeStartJob, dsAfterStartJob,
dsBeforeEndJob, dsAfterEndJob,
dsBeforeStartPage, dsAfterStartPage,
dsBeforeEndPage, dsAfterEndPage,
dsBeforeDrawCommand, dsAfterDrawCommand);
3. new ppPCL.pas unit that can be used to help make sending commands
simpler.
Here is a simple example:
uses
ppTypes,
ppPCL;
procedure TForm1.ppReport1PrinterDeviceStateChange(Sender: TObject;
aStateChange: TppDeviceStateType);
begin
if (aStateChange = dsBeforeStartPage) then
begin
// print 2 copies of page 1
if ppReport1.PrinterDevice.CurrentPage.PageNo = 1 then
ppReport1.Printer.SendEscape(TppPCL.JobControl.NumberOfCopies(2))
else
ppReport1.Printer.SendEscape(TppPCL.JobControl.NumberOfCopies(1));
end;
end;
--
Nard Moseley
Digital Metaphors
www.digital-metaphors.com
Best regards,
Nard Moseley
Digital Metaphors
www.digital-metaphors.com