Sending File to Zebra Printer from NAV

Emaz
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:

Regards.
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:

Regards.
0
Answers
-
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 Lynge0 -
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 printerRegards
xStepa0 -
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.blog0 -
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
xStepa0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions