Sending File to Zebra Printer from NAV

EmazEmaz Member Posts: 18
Hi,

I'm trying to send a file to a Zebra printer.

I create a file, put it in a network path (UNC) and send it to the printer.
"Seems" to work so far. Means, the file appears in the printer queue (status "In the queue") and is deleted again.
Apparently everything is going right. However, nothing is printed ...

Anyone have an idea what I'm missing?

I used the following DotNet variables:

PrintDocument = System.Drawing.Printing.PrintDocument.'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
PrinterSettings = System.Drawing.Printing.PrinterSettings.'System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

An this is my Code:

kw78ycb8bbrl.png


Regards.

Answers

  • lyngelynge Member Posts: 85
    Are you writing ZPL commands directly to a spooler on the windows server?

    A few years ago (in a former job), i had the same issue.

    Unfortunately i don't have the code anymore and I cannot recall the exact issues we saw.
    But i can remember that we ended up in sending the ZPL commands directly to the printers TCP/IP ip-address and port (think we used dotnet directly in NAV for that?).
    It worked perfectly... So if your Zebra got at network interface that might be a solution.

    Note: I'm not sure if you can share the printer between multiple PCs this way - but it might actually work if the printer is intelligent enough.

    Best regards,
    Gert Lynge
  • xStepaxStepa Member Posts: 106
    Hi, if you are printing from report, than you can use report.Print ...
    In case of ZPL string, use TCPClient (System.Net.Sockets.TcpClient) for a printer with IP and Copy (System.IO.File) for a shared printer
    Regards
    xStepa
  • JuhlJuhl Member Posts: 724
    I wrote a blog about it once, maybe it could help.
    https://navandbeyond.wordpress.com/2017/04/26/direct-print-using-net/
    Follow me on my blog juhl.blog
  • EmazEmaz Member Posts: 18
    Hi,

    @lynge : yes, this is my aim.

    @xStepa: i don´t use Reports. I want to send a ZPL String to a shared Printer. Maybe you also have an example how the programming code can look like?

    @Juhl: I will also try the suggestion in your blog, too.

    Thanks @all.

    Regards.
  • xStepaxStepa Member Posts: 106
    of course, no magic ...
    PrintedText := FileHandler.GetTempFileName();
    
    SharedPrinter.AppendAllText(PrintedText, pTextToPrint, Encoding.Default);
    SharedPrinter.Copy(PrintedText, pZebraPrinter);
    
    IF SharedPrinter.Exists(PrintedText) THEN
      SharedPrinter.Delete(PrintedText);
    
    Regards
    xStepa
  • EmazEmaz Member Posts: 18
    edited 2020-03-24
    Hi xStepa,

    it works.

    Thanks @all.

    Regards
    Emaz
Sign In or Register to comment.