Module pdfimposer :: Class StreamConverter

Class StreamConverter

source code

AbstractConverter --+
                    |
                   StreamConverter

This class performs conversions on file-like objects (e.g. a StreamIO).
Instance Methods
 
__init__(self, input_stream, output_stream, layout='2x1', format='A4', flip=TwoSidedFlip.SHORT_EDGE, copy_pages=False)
Create a StreamConverter.
source code
 
get_input_height(self)
Return the page height of the input document.
source code
 
get_input_width(self)
Return the page width of the input document.
source code
 
get_page_count(self)
Return the number of pages of the input document.
source code
 
bookletize(self)
Convert a linear document to a booklet.
source code
 
reduce(self)
Put multiple input pages on one output page.
source code
 
linearize(self, booklet=True)
Convert a booklet to a linear document.
source code
 
get_copy_pages(self)
Get wether the same group of input pages will be copied to fill the corresponding output page or not. (Inherited from pdfimposer.AbstractConverter)
source code
 
get_increasing_factor(self)
Calculate the increasing factor. (Inherited from pdfimposer.AbstractConverter)
source code
 
get_input_format(self)
Return the format of the input paper (Inherited from pdfimposer.AbstractConverter)
source code
 
get_input_orientation(self)
Return the page orientation of the input document. (Inherited from pdfimposer.AbstractConverter)
source code
 
get_input_size(self)
Return the page size of the input document. (Inherited from pdfimposer.AbstractConverter)
source code
 
get_layout(self)
Return the layout of input pages on one output page. (Inherited from pdfimposer.AbstractConverter)
source code
 
get_output_format(self)
Return the format of the output paper. (Inherited from pdfimposer.AbstractConverter)
source code
 
get_output_height(self)
Get the height of the output page. (Inherited from pdfimposer.AbstractConverter)
source code
 
get_output_width(self)
Get the width of the output page. (Inherited from pdfimposer.AbstractConverter)
source code
 
get_pages_in_height(self)
Get the number of input pages to put in the height on one output page. (Inherited from pdfimposer.AbstractConverter)
source code
 
get_pages_in_sheet(self)
Calculate the number of input page that will be put on one output page. (Inherited from pdfimposer.AbstractConverter)
source code
 
get_pages_in_width(self)
Get the number of input pages to put in the width on one output page. (Inherited from pdfimposer.AbstractConverter)
source code
 
get_progress_callback(self)
Get the progress callback function. (Inherited from pdfimposer.AbstractConverter)
source code
 
get_reduction_factor(self)
Calculate the reduction factor. (Inherited from pdfimposer.AbstractConverter)
source code
 
get_two_sided_flip(self)
Get the edge which the paper will be flipped on when printed. (Inherited from pdfimposer.AbstractConverter)
source code
 
set_copy_pages(self, copy_pages)
Set wether the same group of input pages shoud be copied to fill the corresponding output page or not. (Inherited from pdfimposer.AbstractConverter)
source code
 
set_layout(self, layout)
Set the layout of input pages on one output page. (Inherited from pdfimposer.AbstractConverter)
source code
 
set_output_format(self, format)
Set the format of the output paper. (Inherited from pdfimposer.AbstractConverter)
source code
 
set_output_height(self, height)
Set the height of the output page. (Inherited from pdfimposer.AbstractConverter)
source code
 
set_output_width(self, width)
Set the width of the output page. (Inherited from pdfimposer.AbstractConverter)
source code
 
set_pages_in_height(self, num)
Set the number of input pages to put in the height on one output page. (Inherited from pdfimposer.AbstractConverter)
source code
 
set_pages_in_width(self, num)
Set the number of input pages to put in the width on one output page. (Inherited from pdfimposer.AbstractConverter)
source code
 
set_progress_callback(self, progress_callback)
Register a progress callback function. (Inherited from pdfimposer.AbstractConverter)
source code
 
set_two_sided_flip(self, flip)
Set the edge which the paper will be flipped on when printed. Defaults to TwoSidedFlip.SHORT_EDGE, where all the output pages are the right way up. If your printer can only flip over the long edge, set this to TwoSidedFlip.LONG_EDGE. The imposer will rotate all even output pages 180° to compensate. (Inherited from pdfimposer.AbstractConverter)
source code
Class Variables
  page_formats = {"A3":(841, 1190), "A3":(842, 1192), "A4":(595,... (Inherited from pdfimposer.AbstractConverter)
Method Details

__init__(self, input_stream, output_stream, layout='2x1', format='A4', flip=TwoSidedFlip.SHORT_EDGE, copy_pages=False)
(Constructor)

source code 
Create a StreamConverter.
Parameters:
  • input_stream - The file-like object from which tne input PDF document should be read.
  • output_stream - The file-like object to which tne output PDF document should be written.
  • layout - The layout of input pages on one output page (see set_layout).
  • format - The format of the output paper (see set_output_format).
  • copy_pages - Wether the same group of input pages shoud be copied to fill the corresponding output page or not (see set_copy_pages).
Overrides: AbstractConverter.__init__

get_input_height(self)

source code 
Return the page height of the input document.
Returns:
The page height of the input document expressed in default user space units.
Overrides: AbstractConverter.get_input_height
(inherited documentation)

get_input_width(self)

source code 
Return the page width of the input document.
Returns:
The page width of the input document expressed in default user space units.
Overrides: AbstractConverter.get_input_width
(inherited documentation)

get_page_count(self)

source code 
Return the number of pages of the input document.
Returns:
The number of pages of the input document.
Overrides: AbstractConverter.get_page_count
(inherited documentation)

bookletize(self)

source code 

Convert a linear document to a booklet.

Convert a linear document to a booklet, arranging the pages as required.

Overrides: AbstractConverter.bookletize
(inherited documentation)

reduce(self)

source code 
Put multiple input pages on one output page.
Overrides: AbstractConverter.reduce
(inherited documentation)

linearize(self, booklet=True)

source code 

Convert a booklet to a linear document.

Convert a booklet to a linear document, arranging the pages as required.

Overrides: AbstractConverter.linearize
(inherited documentation)