Does someone has already printed to a printronix printer (serie t5000r) using .NET (visual basic or C#) ?
We already have the file (txt) with the code to generate the label until I know the code it's PGL.
What've done was to use file.copy() to send the file to the LPT1 port (we use this method with Zebra printers and it works fine) but the printer print plain text instead of the label with it's format (barcode, titles, etc).
Any idea?
Here is the label code, thank you in advance:
^CONFIG
SFCC;94
END
^CONFIG
LEFT MARGIN;5
END
^PAPER;LENGTH 80
^PAPER;WIDTH 60
^PAPER;PORTRAIT
^CREATE;ds-label
FONT;FACE 92250
ALPHA
AF2;100;DARK;POINT;8;6;45;40
AF4;100;DARK;POINT;13;6;45;40
AF60;100;DARK;POINT;18;6;45;40
AF61;100;POINT;22;6;30;30
STOP
FONT;FACE 93779
ALPHA
POINT;5;6;10;0;Some data 1:
POINT;10;6;10;0;Some data 2:
POINT;15;6;10;0;Delivery Address:
POINT;20;6;10;0;NSC Name:
POINT;24;6;10;0;CODE barcode:
POINT;34;6;10;0;CODE number:
AF63;17;DARK;POINT;37;6;46;23
POINT;39;6;10;0;PID:
AF64;26;DARK;POINT;41;6;28;14
POINT;43;6;10;0;Label Code:
AF65;8;POINT;44;6;15;0
POINT;46;6;10;0;Date:
AF66;10;POINT;47;6;15;0
STOP
BARCODE
C3/9;X1;H10;BF10;17;26;8
STOP
END
^EXECUTE;ds-label
^AF2;ALVSBORGSH. YYY-XXX
^AF4;IMMINGHAM PORT IMPORTS
^AF60;THE CITY
^AF61;Great Britain
^BF10;11111111111111111
^AF63;11111111111111111
^AF64;AAAAAAY1T1MMA7290B11111111
^AF65;0067PXXX
^AF66;2008-10-15
^NORMAL
^CONFIG
RESET
END
I guess your text get intercepted somewhere on the way and rendered to a page instead of sent directly to the printer port. I found this article - How to send raw data to a printer by using Visual C# .NET - that may be of help.
Related
I want to capture image via SNAPI API from Symbol (currently Zebra) barcode scanner, model DS4208 (we're also using another but compatible models from Zebra).
Barcode capturing/recognition works pretty well, but looks like SnapiDLL.SNAPI_SnapShot(hScanner) call don't work correctly: no WM_XFERSTATUS message received at all.
Here is small & simplified code snippet:
// Set image format
short[] parms = new short[2] { (short)SnapiParamIds.ImageFileType, (short)SnapiImageTypes.Jpeg };
var retCode = SnapiDLL.SNAPI_SetParameters(parms, 2, _devHandles[0]);
Debug.WriteLine($"SNAPI_SetParameters retCode={retCode}");
Application.DoEvents();
Thread.Sleep(50);
retCode = SnapiDLL.SNAPI_SnapShot(_devHandles[0]);
Debug.WriteLine($"SNAPI_SnapShot retCode={retCode}");
Application.DoEvents();
Thread.Sleep(50);
retCode = SnapiDLL.SNAPI_PullTrigger(_devHandles[0]);
Debug.WriteLine($"SNAPI_PullTrigger retCode={retCode}");
Application.DoEvents();
Thread.Sleep(50);
Return codes always 0 (i.e. no error), but no WM_XFERSTATUS message received by my message handler.
P.S. C# application from Zebra's SDK which is using CoreScanner driver and OCX, is working fine and able to capture images and video. But I'd like to avoid CoreScanner driver installation for some reasons; for barcode scanning small and simple SNAPI.dll works pretty fine, and I expect to get it work for image capturing too - probably, I'm doing something wrong...
P.P.S. Guys, please DO NOT COMMENT if you have NO EXPERIENCE WORKING WITH SYMBOL BARCODE SCANNERS & SNAPI, and CAN NOT PROVIDE a working snippet!
After contacting Zebra tech support (they are successors of Symbol/Motorola barcode scanner business), I figured out that the imaging/video functionality is broken in SNAPI.dll for the x64 OSes (but most of the rest API calls are working properly). Unfortunately, SNAPI isn't supported by Zebra anymore, and I should use Zebra's CoreScanner API. The good news is: this API is working fine, as it supposed to be. Not a very good news: I should use additional installation package from Zebra.
I am working with Epson Thermal printer and Cash Drawer. Cash Drawer is connected with the printer. Reference to http://keyhut.com/popopen.htm, the code to kick cash drawer is 27,112,0,50,250. I tried to send this code to printer but nothing happens. I used POS for .NET and the printer is registed in SetupPos.
Here is my code:
deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, strLogicalName);
m_Printer = (PosPrinter)posExplorer.CreateInstance(deviceInfo);
m_Printer.Open();
m_Printer.Claim(1000);
m_Printer.DeviceEnabled = true;
//command = "ESC|p|0|25|251";
command = "\x1B|\x70|\x00|\x19|\xFB";
m_Printer.PrintImmediate(PrinterStation.Receipt, command);
//m_Printer.CutPaper(100);
m_Printer.DeviceEnabled = false;
m_Printer.Release();
m_Printer.Close();
Print text is ok, but send code is not working. What can I do? Thanks.
POS for.NET(UnifiedPOS) specification does not support CashDrawer opening by the PrintNormal()/PrintImmediate() method of POSPrinter device.
Since there is a independent CashDrawer device associated with the POSPrinter device, please open() the corresponding device as a CashDrawer and open the drawer with the OpenDrawer() method.
However, depending on the vendor, there is a possibility of supporting usage like you.
I do not have information on whether EPSON POSPrinter supports such usage or not.
Please ask EPSON or your distributor whether or not you can use such a way.
In addition:
Instead of POS for.NET, there is a way to install and use a device driver as a regular Windows Printer.
Some vendors offer Windows Printer Driver for receipt printers and also support paper cutting and drawer opening functions.
In EPSON, it is provided under the name Advanced Printer Driver.
The questioner seems to have solved the problem using this.
However, this device driver is often used exclusively with POS for.NET/OPOS/JavaPOS, and when printing, it is necessary to use Windows standard printing API.
The third code from open drawer kick code "ESC|p|0|25|251" to send is actually a symbol to control cash drawer 1 or 2, which is using '0' or '1'. The 0 or 1 symbol in the ASCII table is mapped to decimal 48 or 49. So you need to use the Hex x30 or x31 not x00.
Just to add more info, the forth and the fifth code are the time when the signal kick is ON or OFF by sending decimal (value between 0 to 255) * 2ms.
I hope this solve the problem if you still want to use the cash drawer kick code and attach the device to the printer.
I am sending commands to a Zebra QLn220 for it to print labels (naturally). I also have code, though, that assigns values to certain printer settings, such as:
const string quote = "\"";
string keepPrinterOn = string.Format("! U1 setvar {0}power.dtr_power_off{0} {0}off{0}", quote);
string advanceToBlackBar = string.Format("! U1 setvar {0}media.sense_mode{0} {0}bar{0}", quote);
string advanceToGap = string.Format("! U1 setvar {0}media.sense_mode{0} {0}gap{0}", quote);
PrintUtils.SendCommandToPrinter(keepPrinterOn);
if (radbtnBar.Checked)
{
PrintUtils.SendCommandToPrinter(advanceToBlackBar);
}
else if (radbtnGap.Checked)
{
PrintUtils.SendCommandToPrinter(advanceToGap);
}
This works - after running that code with radbtnBar checked, those settings are now (as seen via running "! U1 getvar "allcv"" in the Zebra Setup Utilities app):
power.dtr_power_off : off , Choices: on,off
media.sense_mode : bar , Choices: bar,gap
The problem is that after setting those values via the code above, and then attempting to print labels (after a lapse of at least 20 seconds, and have tested up to more than a minute), the first couple of attempts to print a label silently fail (there is no err msg, it is just that no printing takes place). On the third attempt, the label prints. Why would setting these vals cause the printer to temporarily "go deaf," and is there anything I can do to shake it back to wakefulness following the programmatic application of those settings so that it will print immediately?
Once the QLn220 finally regains responsiveness, it continues to print immediately on subsequent executions of the app with no delays; it's only after sending those commands ("power.dtr_power_off" and "media.sense_mode") that the printer is knocked out of its orbit for a season. A real zebra would never be as stubborn as a mule like this.
UPDATE
Banno's idea did the trick, apparently (appending crlfs ("\r\n")) to the commands to set the printer vars.
So it seems that what was happening was something like this:
Command 1 was sent to the printer to set a val (with no crlf).
Command 2 was sent to the printer to set another val (also with no crlf)
A label was then attempted to be printed; it didn't print. Seeing that it did have a crlf, though, the printer seemed to say, "Oh, you finally gave me one of the crlfs you owe me! But you're not getting off that easy - you still owe me one!"
A second attempt to print a label caused the printer to say, in effect, "Okay, then, you've paid your crlf debt; from now on, I will listen to the commands you send (as long as you terminate them with the crlf I so ravenously crave)."
UPDATE 2
Sometimes it still doesn't work (inconsistent behavior); I found that I had to "poke it" to get it to quit its somnambulism; see What Zebra QLn220 settings do I need to set (and to what value[s]) to get a setting to "stick"?
append "\r\n\" to each command
My engraving printer has unique settings for the printer provided by the driver. I know this is common but I'm not sure how it works.
The print driver keeps overriding the DPI to 500, when I want 1000.
I'm using a PrintDocument object in C#. How can I use code to access settings in the print driver? I noticed programs like Access can save print driver settings "per Access form". How do they do it?
for loop below works for identifying device index.
For i = 0 To (Application.Printers.Count - 1) Step 1
Set printCycler = Application.Printers(i)
With printCycler
Msgbox .DeviceName
End With
Next i
I am trying to create a text msg/sms gateway using a USB-HSDPA Modem from Huawei (E122-1).
I have done this with an older Modem some time ago. After some troubles installing the driver and receiving the correct comPort of the new device I have finally established to communicate with the device.
comPort Check and PIN-Check are already done.
Now I'm switching to textmode (CMGF) and write the message (CMGS):
comPort.Write("AT+CMGF=1\r\n");
Thread.Sleep(1000);
comPort.Write("AT+CMGS=\"" + "some tel no" + "\"" + Environment.NewLine);
comPort.Write("text content" + (char)26 + Environment.NewLine);
Thread.Sleep(2000);
response = comPort.ReadExisting();
everything works fine, i get proper responses and everything.
BUT, here is the problem: the sent text message can't be read on all mobile phones/smart phones:
- my old Nokia 6300 says 'unsupported message type'.
- HTC Desire shows an empty message.
- Samsung Galaxy S2 'content is not supported'.
- Samsung Galaxy S shows the message just fine.
Now here is the weird thing, if i use the application which comes with the modem (t-mobile austria internet manager) to send a text message, all of the listed devices can display it correctly.
am I missing something with the encoding or some kind of a header? (which the 't-mobile internet manager' apparently is using for correct displaying of the text message at the receiver side)
any suggestions or ideas?
thanks,
Sise
somehow, the receiver devices are expecting PDU format and not ascii.
something like:
http://www.dreamfabric.com/sms/
but the receiver device i'm requiring this method for is a gps-tracking box and it does understand ascii, so pdu is not required and the application is working fine.
thanks anyways! :)
Try to send in text mode: https://www.diafaan.com/sms-tutorials/gsm-modem-tutorial/at-cmgf/
AT+CMGF=
1 = Text Mode