I am trying to learn how to implement a printer driver such as like CUPS. I found for my printer a file saying "CUPS add-on PPD file for [X] Printer", and in there it mentions it's a raster one.
*cupsFilter: "application/vnd.cups-raster 0 sourcedir1" *cupsFilter: "application/vnd.cups-command 0 sourcedir2"
So from this I gather that I should be looking at one of the 4 "rastertox" files here.
CUPS includes filter programs for many common formats, for example to convert Portable Document Format (PDF) files into device-independent PostScript, and then from device-independent PostScript to device-dependent PostScript. Figure 1 shows the data flow of a typical print job.
So what I'm confused about is what the actual data is that I must send to the printer. I get that it is a print job, but I don't know what the actual document is. It sounds like it either must be a PDF or a PostScript formatted binary file or something like that. But I'm wondering, what if I just have a very simple data structure like an SVG path defining a simple curve, and I want to print that. Say I have it as an array of
points. I wonder if there is simply any way I can basically directly draw to the printer device these vector points, so it does the printing of it, or if it must go through an intermediate more "standard" layer like PostScript or PDF. But in my case, the PPD says "raster", so I would like to know if raster is a different format than PostScript/PDF, and where I can find the documentation on the details on that related to how CUPS works.
Basically I'm looking for somewhere in the CUPS source code or elsewhere where this "raster" format is defined, and where I can see some data structures so I know what is being exactly sent to the printer. I see in the CUPS repo
imagetoraster mentioned here:
- This function is used by raster image processing (RIP) filters like
- cgpdftoraster and imagetoraster when writing CUPS raster data for a page.
- It is not used by raster printer driver filters which only read CUPS
- raster data.
But I don't see where that's defined. Hmm. Something is missing.