CAPS Universe documentation  1.0.4
All you need to know to be successful
Data Structures | Macros | Functions | Variables
doc-parameter-processing.c File Reference

Process printing parameters and configure a printing job. More...

Data Structures

struct  option_function_relation
 Printing parameter keywords and their corresponding handler function. More...
 

Macros

#define DEFAULT_ENABLE   1
 
#define DEFAULT_DISABLE   0
 

Functions

static bool string_is_valid (const char *str)
 
static void add_range_entry (struct caps_var_table *tab, unsigned start, unsigned stop)
 
static void ensure_one_page_range (struct caps_var_table *tab)
 
static int range_compare (const void *restrict p1, const void *restrict p2)
 
static void sort_range_list (struct caps_var_table *tab)
 
static void move_range_entries (struct doc_page_range_entry *to, const struct doc_page_range_entry *from, size_t cnt)
 
static void merge_range_list (struct caps_var_table *tab)
 
static int ipp_get_fidelity_value (struct document_desc *job, const char *value)
 
static void remove_whitespaces (char *value)
 
static int ipp_get_page_range_value (struct document_desc *job, const char *string)
 
static int caps_ppd_handle_media_value (struct document_desc *job, const char *value)
 
static int ipp_get_orientation_value (struct document_desc *job, const char *value)
 
static int ipp_get_copies_value (struct document_desc *job, const char *value)
 
static int ipp_get_document_value (struct document_desc *job, const char *type)
 
static int ipp_get_collate_value (struct document_desc *job, const char *value)
 
static int ipp_get_quality_value (struct document_desc *job, const char *value)
 
static int ipp_get_resolution_value (struct document_desc *job, const char *value)
 
static int ipp_get_sides_value (struct document_desc *job, const char *value)
 
static int ipp_page_fit_positive (struct document_desc *job, const char *value)
 
static int ipp_page_fit_negative (struct document_desc *job, const char *value)
 
static int ipp_auto_fit (struct document_desc *job, const char *value)
 
static int ipp_crop_fit (struct document_desc *job, const char *value)
 
static int ipp_scale_fit (struct document_desc *job, const char *value)
 
static int fit_rotate (struct document_desc *job, const char *value)
 
static int align_left (struct document_desc *job, const char *value)
 
static int align_right (struct document_desc *job, const char *value)
 
static int align_top (struct document_desc *job, const char *value)
 
static int align_bottom (struct document_desc *job, const char *value)
 
static int handle_ipp_parameter (struct document_desc *job, const char *keyword, const char *value)
 
static char * replace_string (char *current, const char *string)
 
static int handle_special_ppd_parameter (struct document_desc *job, const char *keyword, const char *value)
 
static int handle_ppd_parameter (struct document_desc *job, const char *keyword, const char *value)
 
static int process_job_parameter (struct document_desc *job, const char *pparams)
 
static void job_printing_defaults_log (const struct document_desc *job)
 
static void job_printing_resolution_defaults (struct document_desc *job)
 
static void job_printing_defaults_init (struct document_desc *job)
 
struct document_descjob_create (int fd, struct caps_ppd_options_table *ppd_options, const char *params)
 
void job_destroy (struct document_desc *job)
 

Variables

static const struct option_function_relation supported_ipp_options []
 
static const struct caps_table_desc page_range_table_desc
 

Detailed Description

Author
Jürgen Borleis
Warning
Use as experimental

The so called printing parameters are a list of keyword/value pairs (some are of type boolean and may not have a value). Some of the keywords and their values correspond to the content of the PPD file and other keywords and their values are from the IPP universe.

The PPD file corresponding keywords and their values are given, if the user selects a different PPD setting than the default one. If the user doesn't change the defaults, its setting is implicit and doesn't need a reference in the printing parameters.

The IPP related printing parameter keyword/value pairs aren't related to the PPD, they handle common printing options instead. Defining the amount of copies to print is an example here.

Printing command line example:

sides=two-sided-long-edge copies=2 ColorModel=Mono Duplex=DuplexNoTumble

Read the full description in Supported Printing Parameter.

Macro Definition Documentation

◆ DEFAULT_ENABLE

#define DEFAULT_ENABLE   1

◆ DEFAULT_DISABLE

#define DEFAULT_DISABLE   0

Function Documentation

◆ string_is_valid()

static bool string_is_valid ( const char *  str)
static

Check a parameter's value if it is a valid string

Parameters
[in]strString to check
Return values
trueYes, it is a valid string
falseNo, its invalid or empty

A valid string must have a valid pointer (e.g. not NULL) and it must contain at least one valid character.

Note
This is more a duck test if str looks like a duck

◆ add_range_entry()

static void add_range_entry ( struct caps_var_table tab,
unsigned  start,
unsigned  stop 
)
static
Parameters
[in,out]tabDynamic table to add an entry to
[in]startFirst page to print in this range
[in]stopLast page to prinit in this range
Precondition
start < stop, else stop == 0
Note
Function does not return in case of memory failure

◆ ensure_one_page_range()

static void ensure_one_page_range ( struct caps_var_table tab)
static

Ensure at least one page-range entry is available covering the whole document

Parameters
[in,out]tabThe page-range table to check

Maybe the client hasn't defined any page range, which means "print the whole document", but the page_range_info array is empty in this case - which would mean "print nothing from the document".

Thus, if the page_range_info array is empty, provide at least one element: for the full document: 1 … UINT_MAX.

◆ range_compare()

static int range_compare ( const void *restrict  p1,
const void *restrict  p2 
)
static

Simple compare function for page ranges to be sorted by qsort

Parameters
[in]p1Page range entry #1 to compare against p2
[in]p2Page range entry #2 to compare against p1
Return values
'-1'if p1 < p2
'0'if p1 == p2
'1'if p1 > p2

◆ sort_range_list()

static void sort_range_list ( struct caps_var_table tab)
static

Sort the given page range list

Parameters
[in]tabThe page range list to sort

This sorts the given list of page ranges from the beginning (e.g. page one) to the highest page.

Note
Sorting is required for easier duplex printing support.
 range #1     |---------|
 range #2            |-----|
 result: kept

 range #1            |-----|
 range #2     |---------|
 result:
 range #1     |---------|
 range #2            |-----|
 --> the lower 'first' comes earlier in the list

 range #1       |-----|
 range #2     |---------|
 result:
 range #1     |---------|
 range #2       |-----|
 --> the lower 'first' comes earlier in the list
Todo:
It is a really bad idea to sort this list! Keep it as is for manual duplex print.

◆ move_range_entries()

static void move_range_entries ( struct doc_page_range_entry to,
const struct doc_page_range_entry from,
size_t  cnt 
)
static

◆ merge_range_list()

static void merge_range_list ( struct caps_var_table tab)
static

Merge overlapping page range entries into one page range entry

Parameters
[in]tabThe page range list to sort

Merging is required for easier duplex printing support.

 Case #1:
 range #1     |---------|
 range #2                  |-----|
 result:      kept

 Case #2:
 range #1     |---------|
 range #2               |-----| (note same page twice)
 result:      |---------------|

 Case #3:
 range #1     |---------|
 range #2                |----| (note consecutive page)
 result:      |---------------|

 Case #4:
 range #1     |---------|
 range #2            |-----|
 result:      |------------|

 Case #5: -> like case #1 with range #1 up to UINT_MAX
 range #1     |---------|
 range #2       |-----|
 result:      |---------|

 Case #6: -> like case #5
 range #1     |---------|
 range #2     |-----|
 result:      |---------|

 Case #7: -> like case #4
 range #1     |---------|
 range #2     |------------|
 result:      |------------|

 Case #8: -> like case #5
 range #1     |---------|
 range #2         |-----|
 result:      |---------|
Precondition
Already sorted list!
Attention
Never merge the range list. The user defines it by intention!

◆ ipp_get_fidelity_value()

static int ipp_get_fidelity_value ( struct document_desc job,
const char *  value 
)
static

Get the IPP ipp-attribute-fidelity command line parameter's value

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 Always

The given option is of the form ipp-attribute-fidelity=<bool>

The short form ipp-attribute-fidelity is also accepted as true

Note
This is a regular IPP printing parameter

◆ remove_whitespaces()

static void remove_whitespaces ( char *  value)
static

ipp_get_page_range_value() cannot deal with whitespaces, so remove them

Parameters
[in,out]valueThe string to remove all whitespaces from

Removement happen in-place. This will shorten the string.

Precondition
'\0' terminated string

◆ ipp_get_page_range_value()

static int ipp_get_page_range_value ( struct document_desc job,
const char *  string 
)
static

Get the IPP page-ranges command line parameter's value

Parameters
[in,out]jobThe job information to adapt
[in]stringKeyword's value (can be NULL)
Return values
0On success
-EINVALstring is invalid, e.g. NULL or empty or contains all kind of invalid values

The given option is of the form page-ranges=string

Values for string:

  • number -> prints a single page
  • number- -> print begins with page <number> up to the last page
  • -number -> prints from the first page up to page <number>
  • number1-number2 -> print begins with page <number1> up to page <number2>
Todo:
the string can also be of the form: 1-4,7,9-12

Handling of the page-ranges isn't trivial. What does the client means if he offers the string "7-8,2-3,6-7,3-4". Does he want us to really print in that order, or can we sort and re-arange the list?

Currently the list gets sorted and re-aranged here. Thus, the string "7-8,2-3,6-7,3-4" results into the printing page order 2,3,4,6,7,8

Todo:
Sorting the list might be a really bad idea! Think of manually double sided printing! In this case you need to setup the intended order! Provide a INI file option to select the user's choice
Note
This is a regular IPP printing parameter

◆ caps_ppd_handle_media_value()

static int caps_ppd_handle_media_value ( struct document_desc job,
const char *  value 
)
static

Handle the IPP media command line option's value

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 on success, negative errno else

The given option is of the form media=<medium-name>,<medium-size>,<input-tray>

values for <medium-name>: IPP reference

  • For example: 'iso-a4-white', 'iso-a4-colored' or 'iso-a4-transparent'

values for <medium-size>: IPP reference

  • For example: 'iso-a4', 'iso-a3' ...

values for <input-tray>:

  • top: The top input tray in the printer.
  • middle: The middle input tray in the printer.
  • bottom: The bottom input tray in the printer.
  • envelope: The envelope input tray in the printer.
  • manual: The manual feed input tray in the printer.
  • large-capacity: The large capacity input tray in the printer.
  • main: The main input tray
  • side: The side input tray

These entries are used, when no 'PageSize', 'MediaType' or 'InputSlot' are given. Or to be more precise: they can be overwritten.

Note
This is a regular IPP printing parameter (with some CUPS extensions)
If this option is present, it should be handled first, to enable overwriting via 'PageSize' aso.

◆ ipp_get_orientation_value()

static int ipp_get_orientation_value ( struct document_desc job,
const char *  value 
)
static

Get the IPP "orientation-requested" setting

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 on success, negative errno else

The given parameter is of the form orientation-requested=<orientation> If the parameter "landscape" is given it has precedence (TODO Why?)

values for <orientation> are:

  • 3 - portrait, e.g. 'No rotation' if the medium is printed in portrait
  • 4 - landscape, e.g. '90 degrees counter-clockwise' if the medium is printed in portrait
  • 5 - reverse-landscape, e.g. '90 degrees clockwise' if the medium is printed in portrait
  • 6 - reverse-portrait, e.g. '180 degrees' if the medium is printed in portrait
Todo:
How is it really meant?

The original description:

‍Value Symbolic Name and Description

'3' 'portrait': The content will be imaged across the short edge of the medium.

'4' 'landscape': The content will be imaged across the long edge of the medium. Landscape is defined to be a rotation of the print-stream page to be imaged by +90 degrees with respect to the medium (i.e. anti-clockwise) from the portrait orientation. Note: The +90 direction was chosen because simple finishing on the long edge is the same edge whether portrait or landscape

'5' 'reverse-landscape': The content will be imaged across the long edge of the medium. Reverse-landscape is defined to be a rotation of the print-stream page to be imaged by - 90 degrees with respect to the medium (i.e. clockwise) from the portrait orientation. Note: The 'reverse- landscape' value was added because some applications rotate landscape -90 degrees from portrait, rather than +90 degrees.

'6' 'reverse-portrait': The content will be imaged across the short edge of the medium. Reverse-portrait is defined to be a rotation of the print-stream page to be imaged by 180 degrees with respect to the medium from the portrait orientation. Note: The 'reverse-portrait' value was added for use with the "finishings" attribute in cases where the opposite edge is desired for finishing a portrait document on simple finishing devices that have only one finishing position. Thus a 'text'/plain' portrait document can be stapled "on the right" by a simple finishing device as is common use with some middle eastern languages such as Hebrew.

Note
This is a regular IPP printing parameter

◆ ipp_get_copies_value()

static int ipp_get_copies_value ( struct document_desc job,
const char *  value 
)
static

Handle the IPP copies parameter

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Return values
0On success
-EINVALParameter without a value or invalid value

This option needs to be given if the default of '1' isn't satisfying...

Note
This is a regular IPP printing parameter

◆ ipp_get_document_value()

static int ipp_get_document_value ( struct document_desc job,
const char *  type 
)
static

Handle the IPP multiple-document-handling option

Parameters
[in,out]jobThe job information to adapt
[in]typeKeyword's value
Return values
0On success
-EINVALParamter without a value or with an unknown value

The given option is of the form multiple-document-handling=type

Values for type are:

  • single-document
  • separate-documents-uncollated-copies
  • separate-documents-collated-copies
  • single-document-new-sheet
Note
Useful only if multiple documents are supported (which isn't the case in the CAPS universe), but still useful if the printing result should be collated or not, even for a single document, refer ipp_get_collate_value() as well
This is a regular IPP printing parameter

◆ ipp_get_collate_value()

static int ipp_get_collate_value ( struct document_desc job,
const char *  value 
)
static

Handle the CUPS boolean collate parameter

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 Always

The given option is of the form collate=<bool>

The short form collate is also accepted as true

Note
Printing parameter added by CUPS (not a regular IPP parameter)
This parameter has precedence over multiple-document-handling and overwrites its setting, refer ipp_get_document_value() for details

◆ ipp_get_quality_value()

static int ipp_get_quality_value ( struct document_desc job,
const char *  value 
)
static

Get the IPP print-quality parameter

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 Always

The given option is of the form print-quality=<quality>

values for <quality> are

  • '3' - Draft quality
  • '4' - Normal quality
  • '5' - High quality
Note
This is a regular IPP printing parameter

◆ ipp_get_resolution_value()

static int ipp_get_resolution_value ( struct document_desc job,
const char *  value 
)
static

Get the IPP printer-resolution command line value

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 Always

The given option is of the form printer-resolution=<resolution>. (or resolution=<resolution>)

Value for <resolution> is of three values:

  • <integer>x<integer><keyword>
  • cross feed unit DPI (dots per inch) DPM (dots per centimeter)

Example:

  • to print at 2400 DPI by 600 DPI: printer-resolution=2400x600DPI
  • to print at 600 DPI: printer-resolution=600DPI
  • to print at 600 DPI: printer-resolution=600 (unit 'dots per inch' is the default)
Note
The 'cross feed direction' resolution means:
Todo:
Is it worth to support values like '300 x 600 DPI'?
Note
This is a regular IPP printing parameter
The PPD name of the libcapsppd 'Resolution' entry is used in this function for backward compatibility (refer handle_special_ppd_parameter())

◆ ipp_get_sides_value()

static int ipp_get_sides_value ( struct document_desc job,
const char *  value 
)
static

Handle the IPP sides parameter

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Return values
0On success
-EINVALParameter without a value or invalid value

The given parameter is of the form sides=<type>

Supported values of <type> are:

  • one-sided: simplex
  • two-sided-long-edge: duplex at long edge
  • two-sided-short-edge: duplex at short edge
Note
This is a regular IPP printing parameter
The PPD value of the libcapsppd 'Duplex' entry is used in this function for backward compatibility (refer handle_special_ppd_parameter())

◆ ipp_page_fit_positive()

static int ipp_page_fit_positive ( struct document_desc job,
const char *  value 
)
static

Handle fitting parameter fitplot and fit-to-page

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 on success
Note
Are 'fit-to-page' and 'fitplot' are meant the same? Yes!

What does pdftopdf do? "Scale to fit printable area"

◆ ipp_page_fit_negative()

static int ipp_page_fit_negative ( struct document_desc job,
const char *  value 
)
static

Handle non-fitting parameter nofitplot and nofit-to-page

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 on success
Note
nofitplot is a depricated keyword

What does a nofitplot=false mean?

  • auto fit?
  • ignore?

What does a nofitplot=true mean?

  • no fitplot (switch this feature off)

    Todo:
    Are 'nofitplot' and 'nofit-to-page' are meant the same?

◆ ipp_auto_fit()

static int ipp_auto_fit ( struct document_desc job,
const char *  value 
)
static

Handle automatic fitting parameter auto-fit

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 on success

◆ ipp_crop_fit()

static int ipp_crop_fit ( struct document_desc job,
const char *  value 
)
static

Handle crop fitting parameter crop-to-fit

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 on success
Todo:

Maybe ipp_page_fit_negative() can be re-used here

What is the user's expectation if he sets crop-to-fit=false ?

◆ ipp_scale_fit()

static int ipp_scale_fit ( struct document_desc job,
const char *  value 
)
static

Handle automatic scale fitting parameter scale-to-fit

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 on success
Todo:

Maybe ipp_page_fit_positive() can be re-used here

What is the user's expectation if he sets scale-to-fit=false ?

◆ fit_rotate()

static int fit_rotate ( struct document_desc job,
const char *  value 
)
static
Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 on success

◆ align_left()

static int align_left ( struct document_desc job,
const char *  value 
)
static

Handle alignment of the document on a larger medium. Here: align-left

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 on success

◆ align_right()

static int align_right ( struct document_desc job,
const char *  value 
)
static

Handle alignment of the document on a larger medium. Here: align-right

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 on success

◆ align_top()

static int align_top ( struct document_desc job,
const char *  value 
)
static

Handle alignment of the document on a larger medium. Here: align-top

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 on success

◆ align_bottom()

static int align_bottom ( struct document_desc job,
const char *  value 
)
static

Handle alignment of the document on a larger medium. Here: align-bottom

Parameters
[in,out]jobThe job information to adapt
[in]valueKeyword's value
Returns
0 on success

◆ handle_ipp_parameter()

static int handle_ipp_parameter ( struct document_desc job,
const char *  keyword,
const char *  value 
)
static

Handle IPP specific, but generic parameters

Parameters
[in,out]jobThe printing job to manipulate
[in]keywordThe parameter keyword to process (might be not an IPP related parameter)
[in]valueThe parameter keyword's value (might be NULL for boolean IPP parameters)
Return values
0If successfully handled
-ENOTSUPIf the keyword is unknown
-errnoFrom the handler functions, if the parameter is somehow invalid

The PPD file corresponding keywords are ignored here and a -ENOTSUP is returned to inform the caller to continue handling of this keyword in a different (e.g. PPD related) way.

◆ replace_string()

static char * replace_string ( char *  current,
const char *  string 
)
static

Replace a dynamic string if they differ

Parameters
[in]currentCurrent memory allocated with malloc (can be NULL)
[in]stringThe new string to allocate (can be NULL)
Returns
Pointer to new dynamic string or NULL if no new string should be set (string == NULL)

◆ handle_special_ppd_parameter()

static int handle_special_ppd_parameter ( struct document_desc job,
const char *  keyword,
const char *  value 
)
static

Handle special PPD entries generated by libcapsppd

Parameters
[in,out]jobThe job to apply parameters to
[in]keywordPPD keyword to change
[in]valueKeyword's new value, content is volatile
Return values
0The keyword was successfully processed
-ENOTSUPThe keyword isn't one of the special ones

Deal with a few PPD related entries, which are not part of the PPD option list in a generic manner. These kind of entries define some generic print parameter and thus, have only a Default* entry, but not their corresponding value entries. That's why they cannot be handled in handle_ppd_parameter().

PPD parameters handled here:

  • PageSize: Only DefaultPageSize, ImageableArea and PaperDimension are present
  • LeadingEdge: Only DefaultLeadingEdge is present
  • Resolution: Only DefaultResolution is present
  • ColorModel: Only DefaultColorModel is present
  • Duplex: With a parameter like the 'sides' IPP parameter

Some PPD entries require special treatment. They are generated in libcapsppd due to some entries in caps_ppd_base

Note
This function is for backward compatibility
Precondition
There are some expectations regarding PPD file content and PPD options table content created by libcapsppd

◆ handle_ppd_parameter()

static int handle_ppd_parameter ( struct document_desc job,
const char *  keyword,
const char *  value 
)
static

Adapt the printing driver defaults from the PPD in accordance to the parameters

Parameters
[in,out]jobThe job to apply parameters to
[in]keywordPPD keyword to change
[in]valueKeyword's new value (one of the PPD's 'name' entries), content is volatile, can be NULL
Returns
0 on success, negative errno else

We cannot expect a fixed count of keywords here, due to the fact we create the PPD content by our own. Instead a printing provider can add as much new keywords as required to do its job.

For example. A PPD contains the following entries:

keyword name
DefaultResolution 1200x600dpi
Resolution 300dpi
Resolution 600dpi
Resolution 1200x600dpi

A corresponding parameter's value is limited to one of the available Resolution entries (e.g. 300dpi, 600dpi or 1200x600dpi).
In this example the 1200x600dpi value is already selected (e.g. the default). Most clients do not overwrite the default. They only add the Resolution keyword, if a different value than the default was selected by the user. In the example above we would receive here a Resolution=300dpi or Resolution=600dpi.

Other values than the defined ones are ignored here.

Precondition
For each Default<keyword> all possible name components must be part of the ppd_list. E.g. to change the DefaultPageSize, all possible names must be listed in the form PageSize=<name> This is required in order to validate the new name component.

◆ process_job_parameter()

static int process_job_parameter ( struct document_desc job,
const char *  pparams 
)
static

Spread the printing parameters into various structures

Parameters
[in,out]jobThe job to apply parameters to
[in]pparamsThe job parameters (if any, e.g. can be NULL)
Return values
0On success
NegativeErrno value else

The printing parameters are a list of key/value pairs. Some are 'standalone' pairs (defining the copy count for example, IPP related) and some are meant in conjunction with the PPD and its content (to overwrite their defaults). Process this list and store the result into the structure members.

An example for printing parameters could be:

"TonerDensity=1 copies=1 orientation-requested=3 ColorModel=Mono"

Note
The given parameters are processed from the left to the right. This might be important, since some parameters cover the same feature and can overwrite each other.
Todo:
Do some more sanity checks

◆ job_printing_defaults_log()

static void job_printing_defaults_log ( const struct document_desc job)
static

Just log the current job's printing parameter settings

Parameters
[in]jobThe job settings to log
Note
To not pollute the log files, the printing parameter settings are logged only at level LIBCAPS_NOISY or above
Precondition
It must be called after applying the run-time printing parameters

◆ job_printing_resolution_defaults()

static void job_printing_resolution_defaults ( struct document_desc job)
static
Note
Does not return in case of an unset resolution entry

◆ job_printing_defaults_init()

static void job_printing_defaults_init ( struct document_desc job)
static

Setup the printing option defaults every print job should begin with

Parameters
[in,out]jobThe job to init

This is a separate function for documentation reasons and its settings must correspond with the documented behaviour.

Precondition
It must be called prior applying the run-time printing parameters.

◆ job_create()

struct document_desc * job_create ( int  fd,
struct caps_ppd_options_table ppd_options,
const char *  params 
)

Create a new job data collection

Parameters
[in]fdThe documents file descriptor for reading
[in]ppd_optionsThe job's corresponding default PPD settings
[in]paramsThe print parameter (can be NULL)
Return values
PointerA pointer to a dynamic job data collection structure

Creates a job and pre-process the ppd_options and params.

Note
Does not return in case of a memory failure
The ppd_options table will be freed by job_destroy()
Postcondition
Needs to be freed with job_destroy() when done

◆ job_destroy()

void job_destroy ( struct document_desc job)

Free job related data

Parameters
[in]jobThe job data collection to destroy

Frees the related resources and closes the document related file descriptor on demand

Variable Documentation

◆ supported_ipp_options

const struct option_function_relation supported_ipp_options[]
static
Initial value:
= {
{ .keyword = "copies", .handler = ipp_get_copies_value, },
{ .keyword = "sides", .handler = ipp_get_sides_value, },
{ .keyword = "page-ranges", .handler = ipp_get_page_range_value, },
{ .keyword = "ipp-attribute-fidelity", .handler = ipp_get_fidelity_value, },
{ .keyword = "media", .handler = caps_ppd_handle_media_value, },
{ .keyword = "multiple-document-handling", .handler = ipp_get_document_value, },
{ .keyword = "collate", .handler = ipp_get_collate_value, },
{ .keyword = "orientation-requested", .handler = ipp_get_orientation_value, },
{ .keyword = "print-quality", .handler = ipp_get_quality_value, },
{ .keyword = "printer-resolution", .handler = ipp_get_resolution_value, },
{ .keyword = "resolution", .handler = ipp_get_resolution_value, },
{ .keyword = "fit-to-page", .handler = ipp_page_fit_positive, },
{ .keyword = "fitplot", .handler = ipp_page_fit_positive, },
{ .keyword = "nofitplot", .handler = ipp_page_fit_negative, },
{ .keyword = "nofit-to-page", .handler = ipp_page_fit_negative, },
{ .keyword = "auto-fit", .handler = ipp_auto_fit, },
{ .keyword = "crop-to-fit", .handler = ipp_crop_fit, },
{ .keyword = "scale-to-fit", .handler = ipp_scale_fit, },
{ .keyword = "rotate-to-fit", .handler = fit_rotate, },
{ .keyword = "align-left", .handler = align_left, },
{ .keyword = "align-right", .handler = align_right, },
{ .keyword = "align-top", .handler = align_top, },
{ .keyword = "align-bottom", .handler = align_bottom, },
}
static int align_bottom(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:1385
static int caps_ppd_handle_media_value(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:585
static int ipp_crop_fit(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:1219
static int ipp_get_orientation_value(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:676
static int ipp_get_fidelity_value(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:319
static int ipp_page_fit_positive(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:1102
static int ipp_get_collate_value(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:845
static int align_left(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:1328
static int ipp_scale_fit(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:1249
static int ipp_get_resolution_value(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:937
static int align_right(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:1347
static int ipp_auto_fit(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:1183
static int ipp_get_sides_value(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:1056
static int fit_rotate(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:1277
static int ipp_get_document_value(struct document_desc *job, const char *type)
Definition: doc-parameter-processing.c:791
static int ipp_get_page_range_value(struct document_desc *job, const char *string)
Definition: doc-parameter-processing.c:412
static int ipp_get_quality_value(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:879
static int ipp_page_fit_negative(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:1141
static int ipp_get_copies_value(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:741
static int align_top(struct document_desc *job, const char *value)
Definition: doc-parameter-processing.c:1366

Printing parameter keywords and their corresponding handler function

Attention
For some printing parameters the order is important. So keep the order of this list

◆ page_range_table_desc

const struct caps_table_desc page_range_table_desc
static
Initial value:
= {
.element_sz = sizeof(struct doc_page_range_entry),
.increment = 3,
}
Definition: libcapsraster-local.h:331