tags:

views:

51

answers:

1

hi guys,

I'm running out of ideas.

I'm using C by the way via inpout32.dll.

I have these "bytes"(e.g. 0000,00CC) being read from the printer data ports D0-7 or D1-8.

I need to filter out human readable characters when a print job is being done.

This is still very primitive, but I've got a listener function catching these data using inp32.

Basically if I do a print in notepad like 'Hello World', this will be pulled out from the byte being read by inp32 function.

the printer port listener is on a separate app.


the idea is that the app can listen in on any printer.

It's basically a PoC at the moment.

but what I'm using right now to test is a Canon BJC-1000SP, it's pretty old but it's the only parallel port printer we've got at the office. the others are USB types.

I'm using this on Windows at the moment.

Thermal Printers are actually the ones we'll be listening on.


So now I'm trying to use a generic driver that allows raw text file to print.

How can I extract text from it via the port?


If anybody can give me an idea, a function/converter or where to search, that would be great.

A: 

If all you read is already human-readable text, just store it all.

If not, you need to think about the character encoding in use. If it's plain old ASCII, you can probably just call isprint() to determine if a byte is a printable character.

The above of course assumes that your printer is talking plain-text, which probably means it has to be a rather old and simplistic printer (like a dot-matrix from ~20 years ago, or so).

If it's a modern "Win-Printer" laser or inkjet, with all the intelligence of page layout being done by the host computer in the driver, you're probably out of luck. In these cases, what is transmitted is the instructions to layout the page, typically in a printer-specific format.

I think you should edit your question and specify exactly what printer you're using, and in which operating system environment you're running your program.

Update: The Canon BJC-1000 printer you're currently using is an inkjet. It very probably relies on the host computer to send it line-by-line (as in ink lines, not text lines) of data to control the various ink nozzles. I don't think it ever sends plain text to the printer. You could investigate by reading through the code of an open source driver. For Linux, the recommended driver is called gutenprint.

unwind
what I'm reading are the bytes being thrown to the data registers of the parallel port, so they're not human readable off the bat. I tried several ctype functions earlier also.So what I need somehow is to extract 'data' from those bytes. or maybe I think collect them first cuz I'm still not sure if they're being passed as fragments to the printer. I'll look into it more tomorrow. thanks!
TRF
basically I need to pull the 'Hello World' text from the bytes being passed thru the data ports.
TRF
how about thermal printers? are they ASCII? basically we'll be using thermal printers eventually. thanks!
TRF