0

Our app prints directly to a Zebra UPS printer (Zebra GK420d). The list of printing commands are formatted as expected by the ExtEscape (Zebra Printer direct communication).

Printing works as expected on the local machine with the USB printer attached however nothing gets printed when using the app from a remote machine via remote desktop. All computers are running Windows 10 with latest updates.

A test was done sending the following commands from the local and remote machine while the printer is paused:

  ^FX
  ^XA
  ^LH30,30
  ^FO20,10
  ^ADN,18,20
  ^FDTest^FS
  ^XZ

It is possible to print the above commands correctly from the remote machine if saving it to a file and copying the file to \\printer_name.

The following is the method used to print the commands that are passed as a string argument:

procedure SendCommandsToPrinter(ACommands: string);
var
  FmtLabel: AnsiString;
begin
  FmtLabel := '00' + AnsiString(ACommands);
  PWord(FmtLabel)^ := Length(FmtLabel) - 2; // store the length
  Printer.BeginDoc;
  if ExtEscape(Printer.Canvas.Handle, PASSTHROUGH, Length(FmtLabel), Pointer(FmtLabel), 0, nil) <= 0 then
    raise Exception.Create('Printer error');
  Printer.EndDoc;
end;

The spooled files generated on C:\Windows\System32\spool\PRINTERS folder have different content, the file generated running the app on the local machine has the exact same commands that were sent to the printer while the file generated while running the app on a remote machine have the following content:

  CT~~CD,~CC^~CT~
  ^XA
  ^PW812
  ^POI^PQ1,0,1,Y^XZ

Anyone having similar issues with Zebra printers when printing remotelly? Any ideas on how to solve this issue?

Thanks in advance.

Roberto
  • 11
  • Generally this would be done by raw printing using the driver from "Generic" from the Manufacturer list and "Generic/Text Only" from the Printers list. – Brian Jul 31 '19 at 14:23
  • Could it be related to fonts? For example, a font on one machine which isn't on the other? – Jerry Dodge Jul 31 '19 at 15:28
  • The commands inform the printer about the fonts and all, so it is unlikely to be related to that. Same for generic printer driver, when sending data directly from remote using method ExtEscape() above the data sent is not the same as the one received. – Roberto Jul 31 '19 at 15:56
  • I guess it is just an unfortunate blunder that you sent a different command set from the remote machine, so you can't really compare the two. (you don't claim that you sent those `^FX^XA^LH30,30^FO20,10^ADN,18,20^FDTest^FS^XZ` and received `CT~~CD,~CC^~CT~^XA^PW812^POI^PQ1,0,1,Y^XZ` at the other end, no?) Maybe the latter is a previous local test, left in the spooler somehow? – Tom Brunberg Jul 31 '19 at 18:12
  • No it is not older files left on the spooler, the issue is reproducible. Same issue can be found if using "Printer.Canvas.TextOut(10, 10, ACommands);" instead of the line with the "ExtEscape" on the code above. – Roberto Aug 01 '19 at 13:29
  • Using a generic text printer the spooled files have different content as well, often the remote spooled file has 0 bytes (it depends if writing directly with the ExtEscape or not). It looks like the issue is connected to https://support.microsoft.com/en-us/help/2779300/v4-print-drivers-using-raw-mode-to-send-pcl-postscript-directly-to-the where Windows manipulate the job as a XPS document, but I couldn't find definition XPS_PASS in delphi and it seems method ExtEscape do not work with that (https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-extescape). – Roberto Aug 01 '19 at 13:32

0 Answers0