CAPS Universe documentation  1.0.4
All you need to know to be successful
Functions
doc-print-duplex.c File Reference

Routines to manage duplex printing. More...

Functions

static bool prepare_next_medium (struct document_desc *job)
 
static void duplex_front_side_setup (struct document_desc *job)
 
static void duplex_reverse_side_setup (struct document_desc *job)
 
static void duplex_one_copy_per_medium (struct document_desc *job)
 
static void duplex_hw_copies_per_medium (struct document_desc *job)
 
static void duplex_copies_per_medium (struct document_desc *job)
 
void duplex_next_page (struct document_desc *job)
 
void duplex_collating_next_page (struct document_desc *job)
 

Detailed Description

Author
Jürgen Borleis
Version
1.0.0
Warning
Use as experimental

These routines covers the following use cases:

If the printer supports copies in hardware it will be used.

Function Documentation

◆ prepare_next_medium()

static bool prepare_next_medium ( struct document_desc job)
static

Collect the information about the next medium to be printed in duplex manner

Parameters
[in,out]jobInfos about the print job
Return values
falsestate is updated but this isn't the last medium to print
truestate is updated and this is the last medium to print

Always prepare for two sides. Keep page ranges in mind, they influence the sides to print. By retrieving the next page number we get an information what side of a medium is the start side

If this page number is odd:

  • we start with the front side.
  • if the next page number is the consecutive one, this medium has a reverse side as well
  • else, this medium has no reverse side to print

If this page number is even:

  • we start with the reverse side and there is no front side for this medium.
Note
rstr_print_state::current_page isn't touched here

◆ duplex_front_side_setup()

static void duplex_front_side_setup ( struct document_desc job)
static

Setup front page settings for the printer driver

Parameters
[in,out]jobInfos about the print job

Here the descision is made if both sides of a medium are to be printed or the front sizee only. In the front side only case, the medium is ejected without a rever side.

◆ duplex_reverse_side_setup()

static void duplex_reverse_side_setup ( struct document_desc job)
static

Setup reverse page settings for the printer driver

Parameters
[in,out]jobInfos about the print job

◆ duplex_one_copy_per_medium()

static void duplex_one_copy_per_medium ( struct document_desc job)
static

Print one copy per medium

Parameters
[in,out]jobInfos about the print job

This is a copy of duplex_collating_next_page()

◆ duplex_hw_copies_per_medium()

static void duplex_hw_copies_per_medium ( struct document_desc job)
static

Print the copies of a medium at the printer

Parameters
[in,out]jobInfos about the print job

This is simple: just send the printer the available sides and let it print it n times.

◆ duplex_copies_per_medium()

static void duplex_copies_per_medium ( struct document_desc job)
static

Print copies of media (non-collating)

Parameters
[in,out]jobInfos about the print job

If the printer hardware doesn't support printing copies by its own, we loop here until all media copies are done. Then we move to the next page/medium. This function is for the non-collating use case with copies per medium.

◆ duplex_next_page()

void duplex_next_page ( struct document_desc job)

Print non-collating duplex with or without copies

Parameters
[in,out]jobInfos about the print job

◆ duplex_collating_next_page()

void duplex_collating_next_page ( struct document_desc job)

Print rstr_print_state::copies_to_be_done of a document

Parameters
[in,out]jobInfos about the print job

This function is mustbe called in a loop until the last page of the last copy was printed. The last page of the last copy is marked via caps_rstr_page_desc::last_page == 1

rstr_print_state::copies_to_be_done can be '1' as well

Precondition
state must be initialized to 0 on the first call
Note
Can be called for the first page as well (rstr_print_state::current_page == 0)