# printer

The printer type represents a printer model. More...

## Data Structures

struct | stp_printfuncs_t
struct | stp_family_t

## Typedefs

typedef struct stp_printer | stp_printer_t
| The printer opaque data type (representation of printer model).

## Functions

int | stp_printer_model_count (void)
| Get the number of available printer models.
const stp_printer_t * | stp_get_printer_by_index (int idx)
| Get a printer model by its index number.
const stp_printer_t * | stp_get_printer_by_long_name (const char *long_name)
| Get a printer model by its long (translated) name.
const stp_printer_t * | stp_get_printer_by_driver (const char *driver)
| Get a printer model by its short name.
const stp_printer_t * | stp_get_printer (const stp_vars_t *v)
| Get the printer model from a vars object.
int | stp_get_printer_index_by_driver (const char *driver)
| Get the printer index number from the printer model short (driver) name.
const char * | stp_printer_get_long_name (const stp_printer_t *p)
| Get a printer model's long (translated) name.
const char * | stp_printer_get_driver (const stp_printer_t *p)
| Get a printer model's short (driver) name.
const char * | stp_printer_get_family (const stp_printer_t *p)
| Get a printer model's family name.
const char * | stp_printer_get_manufacturer (const stp_printer_t *p)
| Get a printer model's manufacturer's name.
int | stp_printer_get_model (const stp_printer_t *p)
| Get a printer model's model number.
const stp_vars_t * | stp_printer_get_defaults (const stp_printer_t *p)
| Get the default vars for a particular printer model.
void | stp_set_printer_defaults (stp_vars_t *v, const stp_printer_t *p)
| Set a vars object to use a particular driver, and set the parameter to its defaults.
int | stp_print (const stp_vars_t *v, stp_image_t *image)
| Print the image.
int | stp_start_job (const stp_vars_t *v, stp_image_t *image)
| Start a print job.
int | stp_end_job (const stp_vars_t *v, stp_image_t *image)
| End a print job.
stp_string_list_t * | stp_get_external_options (const stp_vars_t *v)
| Retrieve options that need to be passed to the underlying print system.
int | stp_get_model_id (const stp_vars_t *v)
int | stp_verify_printer_params (stp_vars_t *v)
int | stp_family_register (stp_list_t *family)
int | stp_family_unregister (stp_list_t *family)
void | stp_initialize_printer_defaults (void)
stp_parameter_list_t | stp_printer_list_parameters (const stp_vars_t *v)
void | stp_printer_describe_parameter (const stp_vars_t *v, const char *name, stp_parameter_t *description)
const char * | stp_describe_output (const stp_vars_t *v)

## Detailed Description

The printer type represents a printer model.

A particular printer model must selected in order to be able to print. Each printer model provides default print options through a default vars object.

## Typedef Documentation

typedef struct stp_printer stp_printer_t

The printer opaque data type (representation of printer model).

## Function Documentation

const char* stp_describe_output | ( | const stp_vars_t * | v | ) |

int stp_end_job | ( | const stp_vars_t * | v,
|  | stp_image_t * | image |
| ) |  |  |

End a print job.

Parameters:

  | v | the vars to use.
  | image | the image to print.

Returns:
  1 on success, 0 on failure.

int stp_family_register | ( | stp_list_t * | family | ) |

int stp_family_unregister | ( | stp_list_t * | family | ) |

stp_string_list_t* stp_get_external_options | ( | const stp_vars_t * | v | ) |

Retrieve options that need to be passed to the underlying print system.

Parameters:

  | v | the vars to use.

Returns:
  list of options in a string list ('name' is the name of the option; 'text' is the value it takes on). NULL return means no external options are required. User must stp_string_list_destroy the list after use.

int stp_get_model_id | ( | const stp_vars_t * | v | ) |

const stp_printer_t* stp_get_printer | ( | const stp_vars_t * | v | ) |

Get the printer model from a vars object.

Parameters:

  | v | the vars to use.

Returns:
  a pointer to the printer model, or NULL on failure. The pointer should not be freed.

const stp_printer_t* stp_get_printer_by_driver | ( | const char * | driver | ) |

Get a printer model by its short name.

Parameters:

  | driver | the printer model's short (driver) name.

Returns:
  a pointer to the printer model, or NULL on failure. The pointer should not be freed.

const stp_printer_t* stp_get_printer_by_index | ( | int | idx | ) |

Get a printer model by its index number.

Parameters:

  | idx | the index number. This must not be greater than (total number of printers - 1).

Returns:
  a pointer to the printer model, or NULL on failure. The pointer should not be freed.

const stp_printer_t* stp_get_printer_by_long_name | ( | const char * | long_name | ) |

Get a printer model by its long (translated) name.

Parameters:

  | long_name | the printer model's long (translated) name.

Returns:
  a pointer to the printer model, or NULL on failure. The pointer should not be freed.

int stp_get_printer_index_by_driver | ( | const char * | driver | ) |

Get the printer index number from the printer model short (driver) name.

Deprecated:
  There should never be any need to use this function.

Parameters:

  | driver | the printer model's short (driver) name.

Returns:
  the index number, or -1 on failure.

void stp_initialize_printer_defaults | ( | void |  | ) |

int stp_print | ( | const stp_vars_t * | v,
|  | stp_image_t * | image |
| ) |  |  |

Print the image.

Warning:
  stp_job_start() must be called prior to the first call to this function.

Parameters:

  | v | the vars to use.
  | image | the image to print.

Returns:
  0 on failure, 1 on success, 2 on abort requested by the driver.

void stp_printer_describe_parameter | ( | const stp_vars_t * | v,
|  | const char * | name,
|  | stp_parameter_t * | description |
| ) |  |  |

const stp_vars_t* stp_printer_get_defaults | ( | const stp_printer_t * | p | ) |

Get the default vars for a particular printer model.

The default vars should be copied to a new vars object and customised prior to printing.

Parameters:

  | p | the printer model to use.

Returns:
  the printer model's default vars.

const char* stp_printer_get_driver | ( | const stp_printer_t * | p | ) |

Get a printer model's short (driver) name.

Parameters:

  | p | the printer model to use.

Returns:
  the short name (should never be freed).

const char* stp_printer_get_family | ( | const stp_printer_t * | p | ) |

Get a printer model's family name.

The family name is the name of the modular "family" driver this model uses.

Parameters:

  | p | the printer model to use.

Returns:
  the family name (should never be freed).

const char* stp_printer_get_long_name | ( | const stp_printer_t * | p | ) |

Get a printer model's long (translated) name.

Parameters:

  | p | the printer model to use.

Returns:
  the long name (should never be freed).

const char* stp_printer_get_manufacturer | ( | const stp_printer_t * | p | ) |

Get a printer model's manufacturer's name.

Parameters:

  | p | the printer model to use.

Returns:
  the manufacturer's name (should never be freed).

int stp_printer_get_model | ( | const stp_printer_t * | p | ) |

Get a printer model's model number.

The model number is used internally by the "family" driver module, and has no meaning out of that context. It bears no relation to the model name/number actually found on the printer itself.

Parameters:

  | p | the printer model to use.

Returns:
  the model number.

stp_parameter_list_t stp_printer_list_parameters | ( | const stp_vars_t * | v | ) |

int stp_printer_model_count | ( | void |  | ) |

Get the number of available printer models.

Returns:
  the number of printer models.

void stp_set_printer_defaults | ( | stp_vars_t * | v,
|  | const stp_printer_t * | p |
| ) |  |  |

Set a vars object to use a particular driver, and set the parameter to its defaults.

Parameters:

  | v | the vars to use.
  | p | the printer model to use.

int stp_start_job | ( | const stp_vars_t * | v,
|  | stp_image_t * | image |
| ) |  |  |

Start a print job.

Warning:
  This function must be called prior to the first call to stp_print().

Parameters:

  | v | the vars to use.
  | image | the image to print.

Returns:
  1 on success, 0 on failure.

int stp_verify_printer_params | ( | stp_vars_t * | v | ) |