Printers common interface - printing

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.

Related

Can a circle be printed/drawn in a printfile with DDS?

Using DDS I know I can print a box and color it in using the the BOX keyword:
A R BOX5 BOX(2.5 0.5 5.1 6.3 0.2 +
A (*COLOR *HIGHLIGHT 3 75)
Is there something similar to create a circle?
According to the DDS Reference: No. I can't find any keywords to directly draw a circle.
My guess is that back in the heyday of high volume impact printers, there was no fast way to print such circles. Note: Impact isn't necessarily the same as dot-matrix printers. Lines were possible with special characters, though. The "language" to steer such a printer was called SCS (SNA Character String).
But you can create a circle as desired with external programs, convert the result to a page segment, using specialized IBM software, and load that via DDS onto a page. See the PAGSEG keyword on the linked documentation for information and caveats. Especially the need to use AFP might pose a serious obstacle. (AFP is — overly simplified and thus not entirely correct — like PCL or PostScript, a page description language. IPDS can be roughly seen as equivalent to PJL.) Ricoh printers sometimes have native IPDS/AFP support. Also, there were some manufacturers for converter boxes, faking an SCS or even IPDS/AFP printer to the host side, and appearing as a PJL/PCL printer data generator to the printer.
The built-in Host Print Transform feature which can be enabled for printer devices converts the spooled output to PCL, so it can be sent to stock printers. The drawback is, it uses local CPU resources which might not be desired. Older releases of the OS might only support SCS with Host Print Transform.
Newer IBM I releases include InfoPrint Server, a java-based background task enabling to convert print jobs on the machine to PDF. I assume this should work with AFP. Not talking about resource usage, though…
Printing on IBM i is a deep rabbit hole in itself. See the accompanying documentation.

What protocol do modern computers use to communicate with printers?

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.

Zebra 105SL (Plus) 2-way communications

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.

printing quickreports with a thermal printer

I want to know if thermal printers work with quickreports designed with delphi 7 before I buy one. I have designed a program that generates a receipt like quickreport but I am not sure whether it will work with an e-pos T220 thermal printer before I buy one. Has anyone used thermal printers with quick reports?
Yes, QuickReports supports thermal printers. Our own software supports exactly this and has been from Delphi versions 4 through XE7 (although I personally have not worked with QR).
This includes both barcode/label printers and receipt printers. The general rule of thumb is, if you can print to a printer from Microsoft Word, then you can print to that printer using QuickReports.
If I recall, if you want to use quality font rendering, you have to choose from a limited set of system fonts, as supported by the printer. You can still use other fonts, but the quality of other fonts isn't guaranteed.
You can also print images, although they are in black/white.

What does a printer driver do? How to intercept/get the data/command it sends to the printer?

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.

Resources