CAPS Universe documentation  1.0.4
All you need to know to be successful
Functions
Retrieving information about the current page to print

Get the information how the current page should be printed. More...

Functions

unsigned caps_drv_page_number_get (struct caps_drv *cdrv)
 
unsigned caps_drv_page_copies_get (struct caps_drv *cdrv)
 
int caps_drv_page_is_duplex_front (struct caps_drv *cdrv)
 
int caps_drv_page_is_duplex_reverse (struct caps_drv *cdrv)
 
int caps_drv_page_is_last_page (struct caps_drv *cdrv)
 
int caps_drv_print_medium_is_to_be_ejected (struct caps_drv *cdrv)
 
struct caps_rect caps_drv_doc_page_size_get (struct caps_drv *cdrv)
 
int caps_drv_predictive_size_get (struct caps_drv *cdrv, struct caps_rect size, struct caps_rect *psize)
 

Detailed Description

All these functions hide the details of libcapsraster behind. You can call them in the caps_generic_driver::page_setup() callback.

Function Documentation

◆ caps_drv_page_number_get()

unsigned caps_drv_page_number_get ( struct caps_drv cdrv)

Get the document page number of the current page

Parameters
[in]cdrvlibcapsdriver handle
Returns
The page number (never '0')
Precondition
Can be called within the caps_generic_driver::page_setup() callback.

◆ caps_drv_page_copies_get()

unsigned caps_drv_page_copies_get ( struct caps_drv cdrv)

Retrieve the amount of page copies to print

Parameters
[in]cdrvlibcapsdriver handle
Return values
PositiveThe number of medium copies of this page to print
0The medium isn't finished yet (regarding duplex print)

For a duplex print, it returns '0' for the first side of the medium. It returns a positive value for the second side of the medium.

Even for duplex print a medium can have only one side. In this case the returned value is positive. At the same time caps_drv_print_medium_is_to_be_ejected() will return true.

Namely the returned value is always valid if caps_drv_print_medium_is_to_be_ejected() returns true.

Duplex example:

Page number front reverse eject last page copies
7 true false false false 0
8 false true true false 1
9 true false true true 1

Simplex example:

Page number front reverse eject last page copies
7 true false true false 1
8 true false true false 1
9 true false true true 1
Attention
medium != page in case of duplex print
Precondition
Can be called within the caps_generic_driver::page_setup() callback.

◆ caps_drv_page_is_duplex_front()

int caps_drv_page_is_duplex_front ( struct caps_drv cdrv)

Retrieve if the current page is the front page of the current medium

Parameters
[in]cdrvlibcapsdriver handle
Return values
1(true) This page is the front page of a duplex or simplex print medium
0(false) This page isn't the front page of a duplex print medium
Note
For simplex print this function always return (true)
Precondition
Can be called within the caps_generic_driver::page_setup() callback.

◆ caps_drv_page_is_duplex_reverse()

int caps_drv_page_is_duplex_reverse ( struct caps_drv cdrv)

Retrieve if the current page is the reverse page of the current medium

Parameters
[in]cdrvlibcapsdriver handle
Return values
1(true) This page is the reverse page of a duplex print medium
0(false) This page isn't the reverse page of a duplex or simplex print medium
Note
For simplex print this function always return (false)
Precondition
Can be called within the caps_generic_driver::page_setup() callback.

◆ caps_drv_page_is_last_page()

int caps_drv_page_is_last_page ( struct caps_drv cdrv)

Retrieve if the current page is last one of the print job

Parameters
[in]cdrvlibcapsdriver handle
Return values
1(true) This page is the last one of the job.
0(false) More pages will follow.

This function signals you that after this page is printed, the job is finished.

Precondition
Can be called within the caps_generic_driver::page_setup() callback.

◆ caps_drv_print_medium_is_to_be_ejected()

int caps_drv_print_medium_is_to_be_ejected ( struct caps_drv cdrv)

Retrieve if the current print medium is to be ejected after the current page is printed

Parameters
[in]cdrvlibcapsdriver handle
Return values
1(true) The medium is to be ejected after the page is printed
0(false) Don't eject the print medium

For duplex prints this function signals you if the print medium is complete or the opposite page/side will follow.

The following example for a duplex print will print one medium with both sides and one medium with one side only.

Page number front reverse eject last page copies
7 true false false false 0
8 false true true false 1
9 true false true true 1
Precondition
Can be called within the caps_generic_driver::page_setup() callback.

◆ caps_drv_doc_page_size_get()

struct caps_rect caps_drv_doc_page_size_get ( struct caps_drv cdrv)

Get the size of the document's current page

Parameters
[in]cdrvlibcapsdriver handle
Returns
The document's medium size in [pts]

This returns the size of the current page, the document is intended for.

Precondition
Can be called within the caps_generic_driver::page_setup() callback.
Todo:
Would it be useful - if available - to switch to a different print medium? Or strictly follow the user's selection? Example: Document with mixed page sizes (A4 / A3), user has selected A4. When printing,the driver could use the available A3 medium if the document's current page is of this format. And use the A4 for all other pages. I think, this would be an unexpected driver behaviour.

◆ caps_drv_predictive_size_get()

int caps_drv_predictive_size_get ( struct caps_drv cdrv,
struct caps_rect  size,
struct caps_rect psize 
)

Make a prediction about the size of the rastered page

Parameters
[in]cdrvlibcapsdriver handle
[in]sizeThe possible or known size. The unknown edge should be '0.0'
[out]psizePredicted size of the raster
Return values
0psize contains a size which should be used as the target raster
-EINVALNo way to predict the missing edge (*psize is invalid)
-ENODATAFIXME (*psize is invalid)
-EAGAINFIXME (*psize is invalid)
Note
Wrapper for caps_rstr_predictive_size_get()