When sending a ZPL print job to print queue of a printer the job spools, but does not print

665 views Asked by At

We are having a problem getting a print job to print using a print server and print queue. The print job shows in the print queue with a status of spooling, but does not print. When stepping through the program line by line, the job shows up in the queue after the PrintSystemJobInfo job = pq.AddJob() line and it stays in the print queue showing it is spooling. The job never prints. Continuing to step through the code the job disappears after the write.Close() line. The print log shared with us by one of the network administrators verifies the job is added to the queue and is deleted without printing.

Below is a stripped down version of the code we are using for the print job. The actual print job contains a lot of ZPL commands including formatting of text. The code below is, based on other posts we've found, should be a simple way to print a print job using a print queue on a print server. This stripped down code and the actual print job with the ZPL commands behave the same meaning that the job gets to the queue, is showing as spooling, but does not print and is deleted after the Close line.

PrintServer ps = new PrintServer(@"\\10.10.15.158"); //example of a print server ip
PrintQueue pq = ps.GetPrintQueue(@"Printer1"); //example name of printer 
PrintSystemJobInfo job = pq.AddJob();
StreamWriter writer = new StreamWriter(job.JobStream);
writer.Write(@"Test label<p>");
writer.Flush();
writer.Close();

The printer works properly for other programs that print to it so we know it is not the printer that is the issue. None of us have much experience using ZPL to print directly to a printer, but we do have a couple programs that print labels properly using ZPL code when sent to a printer IP without using a print server or print queue. This program requires using a print server and queue because we cannot have the labels not printing because the printer is out of ribbon or labels. We have searched for answers and tried different options found on a couple sites, but so far nothing has been able to help us resolve the issue. Any assistance would be greatly appreciated.

Also, I just created an account for this site and this is my first question post so I apologize in advance if this post is not properly set up. Any advice to clean up this post and that can be used in future posts would be happily accepted.

0

There are 0 answers