# python-djvulibre 0.7 documentation

## Annotations

See also

- Lizardtech DjVu Reference: 8.3.4 Annotation Chunk;
- djvused manual: Annotation syntax.

class `djvu.decode.``Annotations`

  Abstract base for document and page annotations.

  Inheritance diagram:

  `wait`()

    Wait until the associated S-expression is available.

  `sexpr`

    Returns: | the associated S-expression.
    Return type: | `djvu.sexpr.Expression`.

    Raises:

    - NotAvailable – if the S-expression is not available; then, `PageInfoMessage` messages with empty `page_job` may be emitted.
    - JobFailed – on failure.

class `djvu.decode.``DocumentAnnotations`(document[, shared=True])

  If shared is true and no document-wide annotations are available, shared annotations are considered document-wide.

  See also

  Actual and proposed changes to the DjVu format: Document annotations and metadata.

  `document`

    Returns: | the concerned document.
    Return type: | `Document`.

class `djvu.decode.``PageAnnotations`(page)
  `page`

    Returns: | the concerned page.
    Return type: | `Page`.

## Mapareas (overprinted annotations)

See also

Lizardtech DjVu Reference: 8.3.4.2 Maparea (overprinted annotations).

class `djvu.decode.``Hyperlinks`(annotations)

  A sequence of `(maparea …)` S-expressions.

The following symbols are pre-defined:

> `djvu.decode.``ANNOTATION_MAPAREA`

>       >>> ANNOTATION_MAPAREA
>       Symbol('maparea')

> `djvu.decode.``MAPAREA_SHAPE_RECTANGLE`

>       >>> MAPAREA_SHAPE_RECTANGLE
>       Symbol('rect')

> `djvu.decode.``MAPAREA_SHAPE_OVAL`

>       >>> MAPAREA_SHAPE_OVAL
>       Symbol('oval')

> `djvu.decode.``MAPAREA_SHAPE_POLYGON`

>       >>> MAPAREA_SHAPE_POLYGON
>       Symbol('poly')

> `djvu.decode.``MAPAREA_SHAPE_LINE`

>       >>> MAPAREA_SHAPE_LINE
>       Symbol('line')

> `djvu.decode.``MAPAREA_SHAPE_TEXT`

>       >>> MAPAREA_SHAPE_TEXT
>       Symbol('text')

> `djvu.decode.``MAPAREA_URI`

>       >>> MAPAREA_URI
>       Symbol('url')

> `djvu.decode.``MAPAREA_URL`

>   Equivalent to `MAPAREA_URI`.

### Border style

See also

Lizardtech DjVu Reference: 8.3.4.2.3.1.1 Border type, 8.3.4.2.3.1.2 Border always visible.

The following symbols are pre-defined:

> `djvu.const.``MAPAREA_BORDER_NONE`

>       >>> MAPAREA_BORDER_NONE
>       Symbol('none')

> `djvu.const.``MAPAREA_BORDER_XOR`

>       >>> MAPAREA_BORDER_XOR
>       Symbol('xor')

> `djvu.const.``MAPAREA_BORDER_SOLID_COLOR`

>       >>> MAPAREA_BORDER_SOLID_COLOR
>       Symbol('border')

> `djvu.const.``MAPAREA_BORDER_SHADOW_IN`

>       >>> MAPAREA_BORDER_SHADOW_IN
>       Symbol('shadow_in')

> `djvu.const.``MAPAREA_BORDER_SHADOW_OUT`

>       >>> MAPAREA_BORDER_SHADOW_OUT
>       Symbol('shadow_out')

> `djvu.const.``MAPAREA_BORDER_ETCHED_IN`

>       >>> MAPAREA_BORDER_ETCHED_IN
>       Symbol('shadow_ein')

> `djvu.const.``MAPAREA_BORDER_ETCHED_OUT`

>       >>> MAPAREA_BORDER_ETCHED_OUT
>       Symbol('shadow_eout')

> `djvu.const.``MAPAREA_SHADOW_BORDERS`

>   A sequence of all shadow border types.

>       >>> MAPAREA_SHADOW_BORDERS
>       (Symbol('shadow_in'), Symbol('shadow_out'), Symbol('shadow_ein'), Symbol('shadow_eout'))

> `djvu.const.``MAPAREA_BORDER_ALWAYS_VISIBLE`

>       >>> MAPAREA_BORDER_ALWAYS_VISIBLE
>       Symbol('border_avis')

The following numeric constant are pre-defined:

> `djvu.const.``MAPAREA_SHADOW_BORDER_MIN_WIDTH`

>       >>> MAPAREA_SHADOW_BORDER_MIN_WIDTH
>       1

> `djvu.const.``MAPAREA_SHADOW_BORDER_MAX_WIDTH`

>       >>> MAPAREA_SHADOW_BORDER_MAX_WIDTH
>       32

### Highlight color and opacity

See also

Lizardtech DjVu Reference: 8.3.4.2.3.1.3 Highlight color and opacity.

The following symbols are pre-defined:

> `djvu.const.``MAPAREA_HIGHLIGHT_COLOR`

>       >>> MAPAREA_HIGHLIGHT_COLOR
>       Symbol('hilite')

> `djvu.const.``MAPAREA_OPACITY`

>       >>> MAPAREA_OPACITY
>       Symbol('opacity')

The following numeric constant are pre-defined:

> `djvu.const.``MAPAREA_OPACITY_MIN`

>       >>> MAPAREA_OPACITY_MIN
>       0

> `djvu.const.``MAPAREA_OPACITY_DEFAULT`

>       >>> MAPAREA_OPACITY_DEFAULT
>       50

> `djvu.const.``MAPAREA_OPACITY_MAX`

>       >>> MAPAREA_OPACITY_MAX
>       100

### Line and text parameters

See also

Lizardtech DjVu Reference: 8.3.4.2.3.1.4 Line and Text parameters.

The following symbols are pre-defined:

> `djvu.const.``MAPAREA_ARROW`

>       >>> MAPAREA_ARROW
>       Symbol('arrow')

> `djvu.const.``MAPAREA_LINE_WIDTH`

>       >>> MAPAREA_LINE_WIDTH
>       Symbol('width')

> `djvu.const.``MAPAREA_LINE_COLOR`

>       >>> MAPAREA_LINE_COLOR
>       Symbol('lineclr')

> `djvu.const.``MAPAREA_BACKGROUND_COLOR`

>       >>> MAPAREA_BACKGROUND_COLOR
>       Symbol('backclr')

> `djvu.const.``MAPAREA_TEXT_COLOR`

>       >>> MAPAREA_TEXT_COLOR
>       Symbol('textclr')

> `djvu.const.``MAPAREA_PUSHPIN`

>       >>> MAPAREA_PUSHPIN
>       Symbol('pushpin')

The following numeric constants are pre-defined:

> `djvu.const.``MAPAREA_LINE_MIN_WIDTH`

>       >>> MAPAREA_LINE_MIN_WIDTH
>       1

The following default colors are pre-defined:

> `djvu.const.``MAPAREA_LINE_COLOR_DEFAULT`

>       >>> MAPAREA_LINE_COLOR_DEFAULT
>       '#000000'

> `djvu.const.``MAPAREA_TEXT_COLOR_DEFAULT`

>       >>> MAPAREA_TEXT_COLOR_DEFAULT
>       '#000000'

## Initial document view

See also

Lizardtech DjVu Reference: 8.3.4.1 Initial Document View.

The following symbols are pre-defined:

> `djvu.const.``ANNOTATION_BACKGROUND`

>       >>> ANNOTATION_BACKGROUND
>       Symbol('background')

> `djvu.const.``ANNOTATION_ZOOM`

>       >>> ANNOTATION_ZOOM
>       Symbol('zoom')

> `djvu.const.``ANNOTATION_MODE`

>       >>> ANNOTATION_MODE
>       Symbol('mode')

> `djvu.const.``ANNOTATION_ALIGN`

>       >>> ANNOTATION_ALIGN
>       Symbol('align')

## Metadata

See also

Actual and proposed changes to the DjVu format (Metadata Annotations, Document Annotations and Metadata).

class `djvu.decode.``Metadata`

  A metadata mapping.

The following sets contain noteworthy metadata keys:

> `djvu.const.``METADATA_BIBTEX_KEYS`

>   Keys borrowed from the BibTeX bibliography system.

>       >>> for key in sorted(METADATA_BIBTEX_KEYS):
>       ...     print(repr(key))
>       ...
>       Symbol('address')
>       Symbol('annote')
>       Symbol('author')
>       Symbol('booktitle')
>       Symbol('chapter')
>       Symbol('crossref')
>       Symbol('edition')
>       Symbol('editor')
>       Symbol('howpublished')
>       Symbol('institution')
>       Symbol('journal')
>       Symbol('key')
>       Symbol('month')
>       Symbol('note')
>       Symbol('number')
>       Symbol('organization')
>       Symbol('pages')
>       Symbol('publisher')
>       Symbol('school')
>       Symbol('series')
>       Symbol('title')
>       Symbol('type')
>       Symbol('volume')
>       Symbol('year')

> `djvu.const.``METADATA_PDFINFO_KEYS`

>   Keys borrowed from the PDF DocInfo.

>       >>> for key in sorted(METADATA_PDFINFO_KEYS):
>       ...     print(repr(key))
>       ...
>       Symbol('Author')
>       Symbol('CreationDate')
>       Symbol('Creator')
>       Symbol('Keywords')
>       Symbol('ModDate')
>       Symbol('Producer')
>       Symbol('Subject')
>       Symbol('Title')
>       Symbol('Trapped')

> `djvu.const.``METADATA_KEYS`

>   Sum of `METADATA_BIBTEX_KEYS` and `METADATA_PDFINFO_KEYS`.

The following symbols are pre-defined:

> `djvu.const.``ANNOTATION_METADATA`

>       >>> ANNOTATION_METADATA
>       Symbol('metadata')

## Printed headers and footers

See also

Lizardtech DjVu Reference (8.3.4.3 Printed headers and footers)

The following symbols are pre-defined:

> `djvu.const.``ANNOTATION_PRINTED_HEADER`

>       >>> ANNOTATION_PRINTED_HEADER
>       Symbol('phead')

> `djvu.const.``ANNOTATION_PRINTED_FOOTER`

>       >>> ANNOTATION_PRINTED_FOOTER
>       Symbol('pfoot')

> `djvu.const.``PRINTER_HEADER_ALIGN_LEFT`

>       >>> PRINTER_HEADER_ALIGN_LEFT
>       Symbol('left')

> `djvu.const.``PRINTER_HEADER_ALIGN_CENTER`

>       >>> PRINTER_HEADER_ALIGN_CENTER
>       Symbol('center')

> `djvu.const.``PRINTER_HEADER_ALIGN_RIGHT`

>       >>> PRINTER_HEADER_ALIGN_RIGHT
>       Symbol('right')