printer

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

## 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_by_device_id (const char *device_id)
| Get a printer model by its IEEE 1284 device ID.
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_device_id (const stp_printer_t *p)
| Get a printer model's IEEE 1284 device ID, if known.
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.
const char * | stp_printer_get_comment (const stp_printer_t *p)
| Get a printer model's comment string.
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 parameters to their defaults.
void | stp_set_printer_defaults_soft (stp_vars_t *v, const stp_printer_t *p)
| Set a vars object to use a particular driver, and set any unset parameters to their 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)
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

## stp_printer_t

typedef struct stp_printer stp_printer_t

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

## Function Documentation

## stp_describe_output()

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

## stp_end_job()

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

extern

End a print job.

Parameters

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

Returns
  1 on success, 0 on failure.

## stp_get_external_options()

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

extern

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.

## stp_get_model_id()

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

extern

## stp_get_printer()

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

extern

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.

## stp_get_printer_by_device_id()

const stp_printer_t * stp_get_printer_by_device_id | ( | const char * | device_id | ) |

extern

Get a printer model by its IEEE 1284 device ID.

Parameters

  device_id | the printer model's device ID.

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

## stp_get_printer_by_driver()

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

extern

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.

## stp_get_printer_by_index()

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

extern

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.

## stp_get_printer_by_long_name()

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

extern

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.

## stp_get_printer_index_by_driver()

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

extern

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.

## stp_initialize_printer_defaults()

void stp_initialize_printer_defaults | ( | void |  | ) |

extern

## stp_print()

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

extern

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.

## stp_printer_describe_parameter()

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

extern

## stp_printer_get_comment()

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

extern

Get a printer model's comment string.

Parameters

  p | the printer model to use.

Returns
  the comments or NULL (should never be freed)

## stp_printer_get_defaults()

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

extern

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.

## stp_printer_get_device_id()

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

extern

Get a printer model's IEEE 1284 device ID, if known.

Parameters

  p | the printer model to use.

Returns
  the IEEE 1284 device ID, or NULL if not known.

## stp_printer_get_driver()

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

extern

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

Parameters

  p | the printer model to use.

Returns
  the short name (should never be freed).

## stp_printer_get_family()

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

extern

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).

## stp_printer_get_long_name()

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

extern

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

Parameters

  p | the printer model to use.

Returns
  the long name (should never be freed).

## stp_printer_get_manufacturer()

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

extern

Get a printer model's manufacturer's name.

Parameters

  p | the printer model to use.

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

## stp_printer_get_model()

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

extern

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_printer_list_parameters()

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

extern

## stp_printer_model_count()

int stp_printer_model_count | ( | void |  | ) |

extern

Get the number of available printer models.

Returns
  the number of printer models.

## stp_set_printer_defaults()

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

extern

Set a vars object to use a particular driver, and set the parameters to their defaults.

Parameters

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

## stp_set_printer_defaults_soft()

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

extern

Set a vars object to use a particular driver, and set any unset parameters to their defaults.

Parameters

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

## stp_start_job()

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

extern

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.

## stp_verify_printer_params()

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

extern