TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jan Montano
NA
2k
0
POS for .NET
Aug 18 2008 6:07 AM
Hi guys,
Have any of you had experience using Microsft POS for .Net? I'm trying to print on an EPSON TM U220 POS printer. But everytime I call PosPrinter.PrintNormal, I get an error saying "It is not initialized" and that's the only info I could get. I could print on the pos printer normally (via textpad or windows test print). I just can't get it to print from my .net Code. I'm not sure if I'm missing something.
Unfortunately, I have no luck googling the error. Here's the sample code I've been using.
string strLogicalName = "PosPrinter";
PosPrinter m_Printer = null;
try
{
//Create PosExplorer
PosExplorer posExplorer = new PosExplorer();
DeviceInfo deviceInfo = null;
try
{
//DeviceCollection deviceCollection = posExplorer.GetDevices(DeviceType.PosPrinter);
deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter,strLogicalName);
// this call returns a valid object
m_Printer =(PosPrinter)posExplorer.CreateInstance(deviceInfo);
}
catch(Exception exception)
{
ChangeButtonStatus();
return;
}
//Open the device
m_Printer.Open();
//Get the exclusive control right for the opened device.
//Then the device is disable from other application.
m_Printer.Claim(1000);
//Enable the device.
bool result = m_Printer.DeviceEnabled = true;
// this call also causes the "It is not initialized" error
//string health = m_Printer.CheckHealth(HealthCheckLevel.External);
}
catch(PosControlException)
{
ChangeButtonStatus();
}
try
{
//As using the PrintNormal method, send strings to a printer, and print it
//[\n] is the standard code for starting a new line.
// ************ ERROR OCCURS HERE ************* IT IS NOT INITIALIZED
m_Printer.PrintNormal(PrinterStation.Receipt,"Hello OPOS for .Net\n");
}
catch(PosControlException exception)
{
MessageBox.Show(exception.ErrorCode.ToString());
}
Reply
Answers (
3
)
print a word document
moving printjobs to other printer in c#