.NET Framework Developer Center >
.NET Development Forums
>
POS for .NET
>
Printing on Ithaca Receipt printer
Printing on Ithaca Receipt printer
- Hi ,
I am using Ithaca Series 90 Plus Printer to print receipts and validate checks. I couldn't find any helpful info to start with. I am using SQl Server reports for both the receipts and check validations. It will helpful if any one here helps me out.
Thanks.
Sree
All Replies
- Hi,
Sql Server Reporting services doesn't work directly with Pos .Net or UPOS. You might be able to write some kind of plug-in that converts the report output to calls to the Pos .Net objects, but there is no in-built support. You are likely better off NOT using reporting services for this, especially check validations that usually require control around the insertion and removal of the document etc. If you really want to use reporting services like this, you'll need to get a Windows Printer driver for that printer, and then print to it as if it was any other printer in Windows (i.e you don't get any special control over it and you still have to live with it's limitations, but you don't have to use Pos .Net or OPOS etc).
The Pos .Net SDK documentation has plenty of information on how to use the PosPrinter objects and the general device usage model. The Epson Pos .Net ADK (which applies to other printer types too, since it uses Pos .Net and is therefore device independent) has some excellent sampes, and there is some sample code in the other posts on this forum dealing with printers.
You will need a service object for the Ithaca printer, but I believe one is available on the web.
The basic programming model is;
Locate the installed devices using an instance of PosExplorer.
Create an instance of the device you want to use, using PosExplorer.
Open the device, Claim the device, Enable the device.
Use the device, if it's a printer this means (usually) using the PrintNormal, PrintBarcode and PrintBitmap methods output your data.
Release the device
Optionally close the device (usually only done if you are shutting down your application or not intending to re-use that printer object instance). - Hi Yort,
Thanks for your reply. Your answers are always helpful. I Installed OPOS for Ithaca Printer and wrote this piece of code which is throwing exception.
Dim tstPrinter As PosPrinter
Dim tstDevice As PosDevice
Dim tstExplorer As New PosExplorer(Me)
Dim deviceinfoCol As DeviceCollection
deviceinfoCol = tstExplorer.GetDevices(DeviceType.PosPrinter)
For Each objDeviceInfo As DeviceInfo In deviceinfoCol
If objDeviceInfo.ServiceObjectName = "Series90" Then
tstPrinter = tstExplorer.CreateInstance(objDeviceInfo)
End If
Next
tstPrinter.Open()
tstPrinter.Claim(1000)
tstPrinter.DeviceEnabled = True
'Dim tstPOSComm As PosCommon
Dim tstPrintStation As PrinterStation = PrinterStation.Receipt
Dim tstPrintTransaction As PrinterTransactionControl = PrinterTransactionControl.Normal
Dim tstPrintRot As PrintRotation = PrintRotation.Normal
Dim dlg As New OpenFileDialog()
dlg.Filter = "Image files|*.bmp;*.gif;*.jpg"
If dlg.ShowDialog() = Windows.Forms.DialogResult.OK Then
tstPrinter.PrintBitmap(tstPrintStation, dlg.FileName, 12, PosPrinter.PrinterBitmapCenter)
End If
At tstprinter.Open() it threw an exception yesterday but not today. Andalso during compiling it says use of unassigned variable for tstPrinter.If we send the package to the client do you need to include OPOS driver installation for them?Can you let me know how can I do it with OPOS i.e., just with POS for .Net - Hi,
First of all, yes, the client always needs a service object installed (which might be an OPOS one or a Pos .Net one). Pos .Net (and OPOS) are just an implementation of a specification that is designed to allow you to use many devices from many manufacturers without writing lots of different code for each one, but in order to achieve that the 'service object' acts as a middle layer which understands the device specific issues and is therefore always required.
I can't help much with the exception unless you can tell me what the exception type is and what error message it has. Is the exception still happening ? It seems like you're saying it's not ? Some service objects need additional setup, if that is the case there is usually some kind of setup or configuration program included with the service object.
I think you are getting the 'use of unassigned variable tsPrinter' because it is *possible* for tsPrinter to be null after your for each loop excecutes. At least, that is why C# would give you that warning (I don't know about VB specifically but presume it is the same). If there is no printer with a service object name of "Series90" then you will loop through all the printers and tsPrinter will still be now. Adding this after the 'Next' command might fix it.
if (tsPrinter == null)
throw new Exception("No printer found."); - BTW - you can avoid this loop:For Each objDeviceInfo As DeviceInfo In deviceinfoCol
If objDeviceInfo.ServiceObjectName = "Series90" Then
tstPrinter = tstExplorer.CreateInstance(objDeviceInfo)
End If
NextAs the API includes a request for a device by name. - Its not throwing exception and also the app gets hanged up at Open() method. I dont know what might be the issue?
- It threw this exception
Microsoft.PointOfService.PosControlException was unhandled
ErrorCodeExtended=0
Message="Method Open threw an exception. Could not read the device name key's default value, or could not convert the Programmatic ID it holds into a valid Class ID."
Source="Microsoft.PointOfService"
StackTrace:
at Microsoft.PointOfService.Legacy.LegacyProxy.ThrowLegacyMethodException(String methodName, Int32 ResultCode, Exception e)
at Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethod(String methodName, Object[]& parameters, Boolean[] byRef)
at Microsoft.PointOfService.Legacy.LegacyProxy.InvokeMethod(String methodName, Object parameter)
at Microsoft.PointOfService.Legacy.LegacyProxy.Open()
at Microsoft.PointOfService.Legacy.LegacyPosPrinter.Open()
at TestAppBonds.Form1.btnPrintRec_Click(Object sender, EventArgs e) in C:\Documents and Settings\snidimusili\Desktop\MyDocuments Back up with Scripts\Visual Studio 2008\Projects\TestAppBonds\TestAppBonds\Form1.vb:line 957
at System.Windows.Forms.Control.OnClick(EventArgs e)
at Infragistics.Win.UltraControlBase.OnClick(EventArgs e)
at Infragistics.Win.Misc.UltraButtonBase.OnClick(EventArgs e)
at Infragistics.Win.Misc.UltraButton.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at TestAppBonds.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: - Hi,
That sounds like the OPOS driver is not correctly installed or configured. You'll need to check with the manufacturer or their documentation to figure out what you need to do, I haven't used the Ithaca drivers myself. It might be that a DLL needs registering, or there is a security issue with the registry keys it uses.
What OS are you using, are you using an administrator account and if you are running Win 7 or Vista are you running 'elevated' or without UAC enabled ? I know the TPG OPOS drivers don't work unless you are an administrator, perhaps the Ithaca stuff has the same problem.


