[open-beos-printing] Re: Printing Question

  • From: "Ithamar R. Adema" <ithamar@xxxxxxxxx>
  • To: "Simon Gauvin" <gauvins@xxxxxxxxx>,open-beos-printing@xxxxxxxxxxxxx
  • Date: Thu, 17 Jan 2002 20:55:57 +0100

Hi,

>I need to understand the basic interface between the print server, and 
the
> printer driver code, such as what is the sequence of calls=3F What if 
the order of
> the calls=3F Who calls who=3F Things like that. The reason is that I 
don't know
> when the default vs the app vs the system settings come into play 
from the
> BMessage that holds them, and where/when does this BMessage get 
created...

There is a freelists list about printing, called open-beos-printing, 
feel free to subscribe and ask questions there. I hope to have the docs 
about the stuff you're asking up on a website soon, but I'll do a quick 
answer for ya here:

The calls that are made by the print server into the printer driver 
addon are the following:

char* add=5Fprinter(char* printer=5Fname);

This one is called just after the printer is created (via the Printers 
preference panel). It can be used to ask the user for additional 
configuration of the printer. It returns either 'printer=5Fname' if all 
went fine, or NULL on failure.

BMessage* default=5Fsettings(BNode* printer);

This is called by the print=5Fserver if an application uses 
BPrintJob::PrintableRect() or simular functions, before having done a 
ConfigurePage() call. The BNode passed is that of the printer spool 
directory, the one that contains the attributes of its configuration 
(i.e. the driver to use, the transport to use, etc). Its returns a 
BMessage containing the default settings for the page config, Be's HP 
Laserjet for example returns:

BMessage: what =3D okok (0x6f6b6f6b, or 1869311851)
    entry     paper=5Frect, type=3D'RECT', c=3D1, size=3D16, data[0]: 
BRect(l:0.0, t:0.0, r:612.0, b:792.0)
    entry printable=5Frect, type=3D'RECT', c=3D1, size=3D16, data[0]: 
BRect(l:18.0, t:18.0, r:594.0, b:774.0)
    entry           xres, type=3D'LONG', c=3D1, size=3D 4, data[0]: 0x12c 
(300, '')
    entry           yres, type=3D'LONG', c=3D1, size=3D 4, data[0]: 0x12c 
(300, '')

The what field is 'okok' is all ok, or 'stop' or 'baad' on failure.

BMessage* config=5Fpage(BNode* printer, BMessage* settings);

This function is called when BPrintJob::ConfigPage() is called. 
'printer' is again the spool dir, 'settings' is the BMessage containing 
the current settings, and it should return a "new BMessage" containing 
either the fields as specified in the dialog, or nothing on failure.

The what field is 'okok' is all ok, or 'stop' or 'baad' on failure.


BMessage* config=5Fjob(BNode* printer, BMessage* settings);

This is the same as config=5Fpage, only for the job settings (page range 
and friends).

BMessage* take=5Fjob(BFile* spool, BNode* printer, BMessage* msg);

Called by the print=5Fserver to actually let the driver start printing. 
'spool' is the spool file, the rest as usual (see above functions).


The above described functions are mostly called in this order. There is 
always a config=5Fpage before a config=5Fjob, if the settings message 
passed to config=5Fjob is empty config=5Fpage is automaticly called by the 
print=5Fserver. This is all handled for you.

There are the attributes of the printer:

        // MIME-type for Printer spool directory
#define PRINTER=5FMIMETYPE                      "application/x-vnd.Be.printer"


        // Attributes attached to PRINTER=5FMIMETYPE
#define PRINTER=5FATTR=5FDRIVER=5FNAME  "Driver Name"
#define PRINTER=5FATTR=5FPRINTER=5FNAME "Printer Name"
#define PRINTER=5FATTR=5FSTATE                  "state"
#define PRINTER=5FATTR=5FTRANSPORT=5FNAME       "transport"
#define PRINTER=5FATTR=5FTRANSPORT=5FADDR       "transport=5Faddress"
#define PRINTER=5FATTR=5FCONNECTION             "connection"
#define PRINTER=5FATTR=5FCOMMENTS               "Comments"
#define PRINTER=5FATTR=5FMODEL                  "=5FMDL"
#define PRINTER=5FATTR=5FPNP=5FSTATE            "=5FPNP"

        // Values for PRINTER=5FATTR=5FSTATE
#define PRINTER=5FSTATE=5FFREE                  "free"
#define PRINTER=5FSTATE=5FBUSY                  "busy"

        // Values for PRINTER=5FATTR=5FCONNECTION
#define PRINTER=5FCONNECTION=5FLOCAL    "Local"
#define PRINTER=5FCONNECTION=5FNETWORK  "Network"


Straight from my print=5Fserver.h :)

Ok, I hope this helps, if not, feel free to ask further on the list, so 
we can share this info with other people interested in printing on 
(Open) BeOS :)

Regards,

Ithamar.



Other related posts: