I've been looking at printer protocols, and it's still not clear to me how today's computers communicate with printers "over the wire."
Historically, I understand that computers basically started as printers (with teletype machines), but today I read about protocols like AirPrint and CUPS; I understand that some printers (all printers?) take PostScript or PDF files as currency, but I've also read about HPPCL on the FreeBSD docs. It seems like most printers ("98%") support the Internet Printing Protocol, which apparently uses simple HTTP to send "various data formats" to the printer, but I've also found source code in the CUPS repo that seems to translate raster into a proprietary language for some EPSON printers. The discussion in this other StackOverflow question seems to indicate that even IPP isn't the be-all-end-all.
I realize this is a very vague question, but I'm also kinda looking for a general answer—how do computers "get stuff to" printers today? Do we mostly send over PDFs & JPEGs, or do we send G-Code-like commands to the printers? Is it a mixture of both? Can I send commands to my printer to have it arbitrarily move the printhead around, like I can do for CNC machines?
I would not be surprised if the answer is "most printers use a proprietary interface; that's why you still need to implement printer drivers." If so—is there a higher-level standard? Is it just whatever Microsoft says needs to go into a printer driver?
Thanks!
There are multiple aspects in your questions:
what are the discovery protocols?
what are the printing
protocols and PDLs.
Discovery protocol: mDNS/DNS-SD, WS-Discovery (WSD)
Printing protocol: WS-Print (WSD), IPP.
IPP is getting more traction now.
Print Definition Language is that finally what format print job is sent to the device. Following are the some of the standard formats: OXPS, PDF, PWG Raster, PCL, PostScript, and other proprietary formats from each printer vendors.
Related
POS systems mostly can detect thermal printers automatically, as far as I know there are only two ways for an installed application on ios to do that, either by faking it as an Airprint or going with IPP protocol. Since it mostly matters for those application that your printer should be on the same network and subnet configuration and Airprint doesn't support thermal printers, I believe that could be choice that they are using. But my question is that if there is another way that they are all doing it? if not how an application on ipad(iOS) can detect those printers without any need for specific driver installation? If anyone can help me with this would be great!
To print to printers from iOS you can either use the AirPrint API with AirPrint enabled printers or you can implement the printer's protocol and PDL within your own application.
Some solutions include a third middleware like component to fill the gap between the mobile app and the actual device. This is not an elegant way but seems to work for some usecases.
The full process consists indeed of two steps: discovery (like setup) and actual printing (like sending a document). With AirPrint you can check the documentation to learn how Bonjour aka ZeroConf works.
I have written a printing application that works well. I can write files, update settings and do most all functionality from one console. But one aspect of the program has eluded me for quite a while: the ability to read the Zebra register/configuration values.
It would be good to periodically be able to read the values on the Zebra and compare them to default known good standards and to be able to reset them if necessary.
Currently, in order to see these values, I need to either use the built-in web page (networked printers only), print a report, or scroll through the printer interface. What I really need to is a method to be able to read these registers values and create a known good setup file.
Has anyone been able to find any SDK or trick to read these values using .NET (C# or vb.Net)?
The application is a windows desktop utility used on my shop floor and I communicate with the printers using either LPT and ethernet interfaces (as applicable).
I would recommend checking out the Zebra Link-OS SDK which has a lot of functionality when it comes to what you can do with Zebra printers. Specifically they have a section titled "Getting all printer settings and their configuration". However the code example they provide will not work unless your printer is a Link-OS enabled printer. If that happens to be the case then great! If not you can use the SGD class within the Zebra.SDK.Printer namespace to use Set-Get-Do commands to retrieve and change information. More information on SGD can be found in this ZPL manual under the SGD Printer Commands section.
What does a printer driver do? For example, when I open a word document, and use File->Print to print the document: what does the printer driver do? Will it convert the .doc document to PostScript, append some printer commands, and then send to the printer?
Another question is how to intercept the data/command the printer driver send to the printer with software, under windows or *nix.
Simply put, a Windows printer driver is a library which implements a Windows-defined interface of device-independent imaging commands, and another interface of communication to devices like printers. Upon receiving calls from the imaging commands interface, it generates a device-specific print file, and sends it to the communications interface.
In the case of the PostScript printer driver, the driver consists of a shared device-independent part which does most of the conversion of imaging commands to PostScript language code, and a device-dependent part which has the data about the paper sizes and capabilities of a particular printer model. This division, and the fact that the shared part is shared, isn't particularly visible to the user.
These printing related interfaces are not simple. Two places to start learning about them are Introduction to Printing, by the Microsoft Dev Center, and the article Windows Driver Model, at Wikipedia
It is possible to intercept the data and send it elsewhere, either at the imaging commands interface or the communications interface. However, it's not a simple task. It requires learning the printing system and its APIs, as in the references above.
What is a common printer interface today? I've read most of them support PostScript and/or PCL. How should I use PS/PCL from an app code (say, under Win32)?
PostScript and PCL are both open-spec as far as I am aware. The definitive source for PostScript would be the PLRM (PostScript Language Reference Manual). PCL's equivalent can be found at this page.
Most modern multi-function printers for office environments will accept a number of different PDLs. PostScript and PCLXL are the most common, but some others are:
PDF, some printers support rendering PDFs directly.
XPS, Microsoft's XML Paper Specification.
TIFF, a bitmap-only page representation.
Many manufacturers also implement a proprietary PDL. Since PostScript, PDF and XPS can be slow to parse and render, a manufacturer often implements a proprietary PDL that is optimised for the printer's hardware and firmware. A lot of manufacturer-rated page-per-minute counts are only possible if you use their custom PDL driver. This technique is also used by low-end budget printers where the hardware is incapable of interpreting high-level PDLs.
In terms of generating this output, usually you do not need to do so, instead you should go through Windows GDI, or depending on your target OS, GDI+. Your drawing and text-output routines will be handled by a printer driver which in turn will generate output for a specific printer. There are also generic drivers out there (Microsoft includes a generic PostScript printer driver) that can be used to generate output that is not specific to any particular printer.
In Windows, you generally use the GDI and let the printer driver translate it to the actual printer language. This gives you complete device independence.
We are making a lab instrument using an ARM9/RTOS system. The client has asked about printing simple reports from the ARM9 system. In this case, we have USB Host support in the RTOS. I'm thinking about printing bitmaps in generic PCL, hoping that will cover the widest range of printers. Is there a better way to approach this? I'm assuming the RTOS does not have printer drivers, and I don't want to support a lot of printers.
We also support USB device mode on our system, so you could plug in a photo printer, and our device would appear to be a USB stick. So that would work, but it's a bit clunky. This will be a C/C++ embedded system
Pretending to be a digital camera and interfacing with a PictBridge printer actually sounds pretty clever. It would remove the need to deal with different printer drivers, and if my understanding of the technology is correct, you could even control the operation of the printer right from your device.
On the other hand, as someone who has used a fair number of computerized lab instruments (oscilloscopes etc.) I find the ability to save screenshots from an ethernet/web interface to be much more useful. Print is dead.
Have you looked at what all the scope vendors are doing? They all have print options (I think) and I don't know what they are doing to solve this problem.
Last time I was involved with something like this, we used serial ports to talk to HP printers using PCL. That backfired as everyone quickly stopped making serial printers!
PostScript is natively supported by most printers, so you could just send it over the wire, but it would be a lot more cumbersome than straight ASCII. There are libraries, but they're bulky.
Since your device can appear to be a USB stick, a simple solution would be to generate a report as a JPEG image and then have the printer open and print it. This way, the people who want paperless output can use the image as-is, and everyone else can print it.
If I understand you correctly, you could write a formatted text file and do a "print" command through Windows in the "usb stick" mode.
For a simple report, it would be best to stick to straight ASCII. If you need some graphics, PCL would be a good choice for B/W laser printers, but I'm not sure how universal it would be for the more common ink-jet printers.
Edit: the PCL Reference Manual is available as a PDF from HP.