DjVu documents¶
-
class
djvu.decode.
Document
¶ DjVu document.
Use
Context.new_document()
to obtain instances of this class.-
decoding_status
¶ Returns: a JobException
subclass indicating the decoding job status.
-
decoding_error
¶ Indicate whether the decoding job failed.
-
decoding_done
¶ Indicate whether the decoding job is done.
-
decoding_job
¶ Return type: DocumentDecodingJob
-
type
¶ Returns: the type of the document. The following values are possible:
DOCUMENT_TYPE_UNKNOWN
DOCUMENT_TYPE_SINGLE_PAGE
single-page documentDOCUMENT_TYPE_BUNDLED
bundled multi-page documentDOCUMENT_TYPE_INDIRECT
indirect multi-page documentDOCUMENT_TYPE_OLD_BUNDLED
(obsolete)DOCUMENT_TYPE_OLD_INDEXED
(obsolete)Before receiving the
DocInfoMessage
,DOCUMENT_TYPE_UNKNOWN
may be returned.
-
pages
¶ Return type: DocumentPages
.
-
files
¶ Return type: DocumentFiles
.
-
outline
¶ Return type: DocumentOutline
.
-
annotations
¶ Return type: DocumentAnnotations
.
-
save
(file[, pages][, wait=True])¶ -
save
(indirect[, pages][, wait=True]) Save the document as:
- a bundled DjVu file or;
- an indirect DjVu document with index file name indirect.
pages argument specifies a subset of saved pages.
If wait is true, wait until the job is done.
Return type: SaveJob
.
-
export_ps
(file[, …][, wait=True])¶ Convert the document into PostScript.
pages argument specifies a subset of saved pages.
If wait is true, wait until the job is done.
Additional options:
- eps
- Produce an Encapsulated PostScript file. Encapsulated PostScript files are suitable for embedding images into other documents. Encapsulated PostScript file can only contain a single page. Setting this option overrides the options copies, orientation, zoom, crop_marks, and booklet.
- level
- Selects the language level of the generated PostScript. Valid language levels are 1, 2, and 3. Level 3 produces the most compact and fast printing PostScript files. Some of these files however require a very modern printer. Level 2 is the default value. The generated PostScript files are almost as compact and work with all but the oldest PostScript printers. Level 1 can be used as a last resort option.
- orientation
Specifies the pages orientation:
PRINT_ORIENTATION_AUTO
automaticPRINT_ORIENTATION_LANDSCAPE
portraitPRINT_ORIENTATION_PORTRAIT
landscape- mode
Specifies how pages should be decoded:
RENDER_COLOR
- render all the layers of the DjVu documents
RENDER_BLACK
- render only the foreground layer mask
RENDER_FOREGROUND
- render only the foreground layer
RENDER_BACKGROUND
- render only the background layer
- zoom
- Specifies a zoom factor. The default zoom factor scales the image to fit the page.
- color
- Specifies whether to generate a color or a gray scale PostScript file. A gray scale PostScript files are smaller and marginally more portable.
- srgb
- The default value, True, generates a PostScript file using device independent colors in compliance with the sRGB specification. Modern printers then produce colors that match the original as well as possible. Specifying a false value generates a PostScript file using device dependent colors. This is sometimes useful with older printers. You can then use the gamma option to tune the output colors.
- gamma
- Specifies a gamma correction factor for the device dependent PostScript colors. Argument must be in range 0.3 to 5.0. Gamma correction normally pertains to cathodic screens only. It gets meaningful for printers because several models interpret device dependent RGB colors by emulating the color response of a cathodic tube.
- copies
- Specifies the number of copies to print.
- frame,
- If true, generate a thin gray border representing the boundaries of the document pages.
- crop_marks
- If true, generate crop marks indicating where pages should be cut.
- text
- Generate hidden text. This option is deprecated. See also the warning below.
- booklet
PRINT_BOOKLET_NO
Disable booklet mode. This is the default.PRINT_BOOKLET_YES
Enable recto/verse booklet mode.PRINT_BOOKLET_RECTO
Enable recto booklet mode.PRINT_BOOKLET_VERSO
Enable verso booklet mode.- booklet_max
- Specifies the maximal number of pages per booklet. A single printout might then be composed of several booklets. The argument is rounded up to the next multiple of 4. Specifying 0 sets no maximal number of pages and ensures that the printout will produce a single booklet. This is the default.
- booklet_align
- Specifies a positive or negative offset applied to the verso of each sheet. The argument is expressed in points [1]. This is useful with certain printers to ensure that both recto and verso are properly aligned. The default value is 0.
- booklet_fold (= (base, increment))
- Specifies the extra margin left between both pages on a single sheet. The base value is expressed in points [1]. This margin is incremented for each outer sheet by value expressed in millipoints. The default value is (18, 200).
[1] (1, 2) 1 pt = in = 0.3528 mm
-
-
class
djvu.decode.
SaveJob
¶ Inheritance diagram:
Document saving job.
Use
Document.save()
to obtain instances of this class.
-
class
djvu.decode.
DocumentDecodingJob
¶ Inheritance diagram:
Document decoding job.
Use
Document.decoding_job
to obtain instances of this class.