Dot Matrix printing - c#

I like lots of people need to print text ONLY to a dot matrix printer.
I have run the example found here.
And It seems to work but only XP it does not seem to work on Wnidows 7.
I have tested using a generic/Text only printo to file driver as I won't have acces to my printer for a couple of dyas.
On XP it asks me for a file name and then creates a file successfully.
On windows 7 the file gets stuck in the print queue which when you view it just says print-error.
I know the generic printer driver works on win7 beacuse I can print to it from my text editor.
The short term solution is to use a direct connection to the LPT port,Ive not tested this yet, but the final project will running on a machine that has no LPT port. In fact we are shortly going to evaluate a new epson that will connect using USB, so LPT is out of the question.
Before anyone sugessts using graphics, they should know that this is an event logging application that needs to print immediatley one line at a time. It cannot wait for a page of text to be ready before printing.

Related

Softek Barcode Reader Issues - Barcode don´t read correctly on a different computer

We have a custom-built imaging application that includes barcode recognition capabilities. We use softek barcode reader API as our recognition codec, and until now, everthing was working fine.
However, recently we sold that application to one of our clients. We deployed it, and we were struck with the fact that the barcode reader simply stopped working rigth. It still "works" on a way, but on the client´s machines, it returns random values (and by random, i mean REALLY random. "05020018" Becomes "16Y", then "4848", then "1024"...) Each read there gives back a different value. Most of the times the value is shorter that it should be, and while the codebar only contains numbers, it oftens gives back letters when i read it.
The software works using a recular (tabletop) scanner. The document is captured and sent to a webservice that stores it on a remote server. Each document have a barcode which stores the "place" that it should be stored on the server. It is normally a long number (24 digits), coding all the relevant information about the document in a custom-made format. Every character is numeric.
The SAME software with the SAME configs on another ambiente works perfectly.
What could be happening? Could it be machine architecture or something else?
Is not the scanner. The same device works on most machines but not on the troublesome one.
.NET 3.5!
Thanks in advance!
** EDIT **
Just to clarify it more, there is not a barcode reader device, just a coding API developed by softek. Their documentation was no help, and I can´t contact them either. Searching for this problem on google didn´t give any results, too.
The configuration for the recognition API are done on our software and stored on the database. We use the same dabatase (same server, same data) on my workplace and the software works fine, so it´s not a software configuration issue, it seens. May it be a conflict with some local, exotic software?
I've worked with other barcode readers in the past, but never Softek. I would suggest that the barcode reader is in some sort of configure mode, that every read is setting some sort of config option.
Try resetting the barcode reader with config codes which are normally in the manual
Is the client scanning different barcodes ( codes specific to them or that they generated) then your other customers?
I've seen the same behaviour with actual barcode readers (ie: using the device, not an API) because the language of the device was set incorrectly. Windows treats the scanner as a keyboard so check the language by going to Control Panel -> Region and Language settings -> Keyboards and Languages -> Change keyboards button -> Installed services panel.

Using C# to detect a printer's power status

I did a lot of search and it comes with nothing.Such as below:
c# check printer status
how do i check if a printer is installed and ready using C#?
I tried all the code I found in here but none of them can tell the status of a printer's power is on or off.
The printer is always plugged in and sometimes it's powered off, so I need to make sure it's powered on and then do the print job.
Real need some help here!
question update
the windows still send the print job to print spool when my printer is off, I don't need this, because my client sometimes will deliberately turn off the printer to avoid print something that he don't need. but windows still send it to spool, when my client turn on the printer again, it prints the thing that exactly he want to avoid.
The legacy code uses kernel32.dll's CreateFile function to open LPT1 as a file and directly write string to it to accomplish then printing function. It got no way to know the status of the printer, it just write string to the parallel port. so when the printer is off, the write function got no return, hence the following code after that will never get executed.
hopefully u can understand what I am trying to do here. I want to avoid the situation to print when the printer is off.

How do you intercept USB printer error messages when using StartDoc()/EndDoc()?

I hope someone can point me in the correct direction regarding the
printing problem I am having below:
Setup:
Win CE 5.0
Trying to print from a custom application.
I have written a very simple printing class in my application that
uses the pcl driver and prints to a HP USB printer. The printing
aspect is fine under normal circumstances, but I cannot see an obvious
way to handle error conditions such as no paper in printer etc.
I am doing something like this (general error checking and other
details removed for clarity):
// Get a DC to the printer. If printer isn't powered this will fail -
can print error stating "printer not found" or similar
hdcPrinter = CreateDC(#"pcl.dll", #"PCL Inkjet", #"LPT2:", ref mode);
// Signal the start of a document
StartDoc(hdcPrinter, &docInfo)
// Signal the start of a page
StartPage(hdcPrinter)
// Prepare the page to print/formatting etc
// Finished preparing the page
EndPage(hdcPrinter)
// This is the only page we are printing this time
EndDoc(hdcPrinter)
// Return the printer DC to the system as we are finished with it now.
DeleteDC(hdcPrinter);
Thanks for any help you can provide,
Shilpa
Are you sure get DC succeeds even if the printer is out of paper, jammed, or otherwise not ready?
Once you start the print job, it isn't your problem if the printer runs into a problem. At that point, the OS is supposed to interact with the user and let them know that there is a problem, restart the job if necessary, etc...

Datalogic Barcode/Weight Scanner

Could anyone please give me any idea as to where to start my coding in order to get data from OPOS(Datalogic Magellan device) weighting and barcode scanning in C#?? For example, what library and what function I should be using for this case. I am clueless as I have already spent numerous of hours searching for an answer online. Not even came close online.
I don't know any api that I can use to get the weight and barcode for the usb device into my C# program.
I am currently using Datalogic scale. I tried the build-in windows reader but it didn't read in any data from the device.
First off, I used the Microsoft.PointOfService library which can directly create connection to most of the opos base machine. And make sure you have your Logical Device Name right! Very Very important. This is NOT any normal name you found in your regedit, it MUST be define manually by yourself inside the opos adk program that you installed along with the opos machine.
Then you can pass in the name as usual in your C# program.
For example: you set USB_Scale as your logical device name inside OPOS program
in C#
this.myDevice = explore.GetDevice("Scale", "USB_Scale");
Note: Make sure you set claim to 1000; It might not work if you didn't do so.
Also : this.myScale = ((Scale)explore.CreateInstance(myDevice)); <- this might help~
The rest is just straight forward.

Transferring Print Jobs Between Printers

We are assigned to develop an application using C# that can transfer print jobs between printers. I have looked on the Windows API, and System.Printing namespace but I can't find a class or function that can do this. Is there a free library out there that is suitable for this? How will you do this using .Net or the Win32 API?
If nothing exists in the Win32 API, then there will be nothing in .NET.
Unless the printer drivers are identical then you may have problems because the printer jobs go through some processing by the driver before entering the queue.
Have you considered a single queue with multiple printers associated with it (this giving more capacity and redundancy in case of printer failure)?
Isn't this a problem of load-balancing/routing a particular job to the least busy printer?
I'm pretty sure you can just CopyFile a SPL file to a new printer port if it's the same driver. If you print in EMF, you may be able to go across different drivers.
The port names might be a bit tricky depending on how the printer(s) are attached. WinObj and the rules of dev naming will be handy for tracking it down.

Categories