CAPS Universe documentation
1.0.4
All you need to know to be successful
|
CAPS universe printer driver convenience library. More...
Features | |
Version info | |
Info for user's code to do the right thing. | |
Using the Printer Driver Framework from your driver | |
The startup. | |
Managing printer driver private data | |
Set and get some driver private data in your callback functions. | |
Managing some configuration information | |
Configuration related helper functions. | |
Define the printer device capabilities | |
Printer Device Capabilities helper functions. | |
Query the printer device and framework status | |
Printer Device and Framework Status helper functions. | |
Retrieving information about the job to print | |
Get the information about the document and how the user wants to print it. | |
Error handling when printing | |
Provide more detailed information about failures. | |
Retrieving information about the current page to print | |
Get the information how the current page should be printed. | |
Setting up the rasterizer for the current page | |
Setup the information the rasterizer requires to rasterize the document page in a way your printer needs it. | |
Get the full medium rasterized dot data to print | |
Reading the full medium raster line by line for your own processing. | |
Get the raw rasterized dot data to print | |
Reading the raw raster line by line for your own processing. | |
Some convenience functions | |
Makes the life easier (sometimes) | |
Access to internals | |
Sometimes there is a need to get our fingers on internal data. | |
Multi core processing framework | |
Multithread framework to improve data processing. | |
This library is a collection of helper functions to simplify printer driver development, since it hides all the communication, rasterization and reporting details of the CAPS universe.
skeleton/
subdirectoryThe startup.
You mainly need to write some code to setup national language support (optional, on demand), trigger the command line parameter parsing and then call the libcapsdriver's caps_drv_run() function.
Instead of doing everything in your printer driver by your own, libcapsdriver uses callbacks into your driver to do all the required steps to start-up and dealing with print jobs. They are called at different stages to deal with print jobs in a generic manner.
Your printer driver callback functions are defined in a caps_generic_driver structure.
A special role has the caps_generic_driver::printer_monitor callback. It is intended to check the state of the printer. Depending on flags managed by libcapsdriver and INI file settings, the monitor callback is called at different points of time (refer caps_drv_printer_tweak_status).
Some printers are in trouble when their status is queried while they are printing at the same time. Thus, the monitor feature can be controlled via an INI setting.
It is called very early while initializing the framework.
0
everything is okay, the framework can continue-EINVAL
Something really bad happened in your initialisation and the framework should terminateIts called after the command line parameter parsing is done and all kind of information is available.
0
everything is okay, the framework can continue-ENODEV
It isn't the expected printing device or something else is bad with this device and the framework should terminateFunctions related to this state:
This callback is called when the framework has received a printing job. It already has checked if it can deal with the document data format, e.g. a corresponding rasterizer is already attached and now it is up to you to check if this job can be printed on your printer.
0
everything is okay, the framework can continue-EINVAL
if the job cannot be printed.-EBUSY
The printer is somehow busy (more or less a printer error condition, cover opened for example)-EBADMSG
?-ENODEV
It isn't the expected printing device or something else is bad with this device and the framework should terminateFunctions related to this state:
Retrieving information about the job to print
Job status updating in case of a failure.
We need to distinguish a bad job from a bad behaviour of the software, e.g just skip the job versus terminating the driver
This callback is called once per job (even if printing has failed somehow).
Called when the job is "done" somehow, e.g.:
Printing can fail due to your own return values in Callback job_start(), or Callback page_setup(), Callback page_print() or Callback printer_monitor() or by failures detected somewhere else in the framework.
0
everything is okay, the framework can continue-ENODEV
if something is really bad with your printer and the framework should terminate. Called when the framework has extracted all required information about the next page to print. It is called once per page.
0
everything is okay, the framework can continue-EINVAL
if the page cannot be printed. TODO error message why!Functions related to this state:
Called when the framework has rasterized the current page and this data is ready to be printed. It is called once per page. E.g. once per medium in simplex print and twice per medium when printing in duplex.
0
everything is okay, the framework can continue-EINVAL
if the page cannot be processed/printed and the job should be terminated.-ENODEV
if something is really bad with your printer and the framework should terminate.-ENXIO
if a transaction with the printer's stream failed and the framework should terminate.-EINVAL
and -ENXIO
, you should use caps_drv_job_canceled() or caps_drv_job_aborted() to set a useful error message why the job was terminated (if you have one. Else the framework will set a generic one, which is most of the time less helpful).Functions related to this state:
Called, when the framework retrieves the status of the printer. But not always. See below.
0
everything is okay, the framework can continue-EBUSY
if the printer isn't ready to print somehow-ENODEV
if something is really bad with your printer and the framework should terminate.-EINVAL
if something is wrong with your printer, but can be recovered. If currently a job is processed it will be canceledlibcapsdriver checks the printer status:
Whenever it checks the printer's status, it calls the callback only if it detects a ready printer device.
Monitoring the printer device might be a sensible task somehow. Thus, its behaviour can be controlled via an INI file setting:
For how to control the behaviour, refer Feature: control printer monitoring
Everything you need to clean up.
0
everything is okay, the framework can continue