Printing ZPL Code to a Shared Printer

Hi, I have stored as variables the Shared Printer path and the ZPL Code.
I need a method of printing the string directly and cannot find much using google.
I can print the string via IP address but our printers will never be used via IP Address in Production.

If i print the ZPL Code manually the correct label prints out of the Zebra label Printer, I’m just not sure how to have that automated on a trigger i can set from the ShipHead table.

Is it possible to print a string directly to a Shared Printer?

@Ricky90 ZPL is just like printing a file, so it should not be a problem. If you are going to do a lot of it using Bartender might be a route to look at.

@gpayne Bartender is not going to be an option I’m afraid.
Im not too sure where to start with direct printing of a string from my BPM.

Here is a thread with some ideas. A BAQ report to a server side printer is probably the most Epicor way to do this. The BAQ could be on anything that returns one row with the ZPL code in a calculated field.

I managed to get this working quite simply by creating a file and copying it to a printer (printer shared name is a variable set based on Workstation logged in to)

Below is the code if it is useful to anyone else.

Where ps is a variable for the PackSlip Number and ShipHead.LabelComment = the zpl string.

foreach (var ShipHead in (from ShipHeadRow in Db.ShipHead.With(LockHint.UpdLock)
where ShipHeadRow.Company == Session.CompanyID
&& ShipHeadRow.PackNum == ps
select ShipHeadRow))


var workstationid = (from userComp in Db.UserComp
join workStation in Db.WorkStation
on userComp.WorkstationID equals workStation.WorkStationID
where userComp.DcdUserID == callContextClient.CurrentUserId
select workStation.WorkStationID).FirstOrDefault();

var deviceid = (from workStation in Db.WorkStation
join device in Db.Device
on workStation.WorkStationID equals device.WorkStationID
where workStation.WorkStationID == workstationid
select device.PrinterID).FirstOrDefault();

var printer = (from device in Db.Device
join sysPrinter in Db.SysPrinter
on device.PrinterID equals sysPrinter.PrinterID
where device.PrinterID == deviceid
select sysPrinter.NetworkPath).FirstOrDefault();

string folder = @"\servername\CarrierFiles";
string fileName = ps + “.zpl”;
string fullPath = folder + fileName;
string [] authors = {ShipHead.LabelComment};
File.WriteAllLines(fullPath, authors);

File.Copy(fullPath, printer, true);


1 Like