Poppler.StructureElement

g GObject.Object GObject.Object Poppler.StructureElement Poppler.StructureElement GObject.Object->Poppler.StructureElement

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

get_abbreviation ()

get_actual_text ()

get_alt_text ()

get_background_color ()

get_baseline_shift ()

get_block_align ()

get_border_color ()

get_border_style ()

get_border_thickness ()

get_bounding_box ()

get_color ()

get_column_count ()

get_column_gaps ()

get_column_widths ()

get_end_indent ()

get_form_description ()

get_form_role ()

get_form_state ()

get_glyph_orientation ()

get_height ()

get_id ()

get_inline_align ()

get_kind ()

get_language ()

get_line_height ()

get_list_numbering ()

get_padding ()

get_page ()

get_placement ()

get_ruby_align ()

get_ruby_position ()

get_space_after ()

get_space_before ()

get_start_indent ()

get_table_border_style ()

get_table_column_span ()

get_table_headers ()

get_table_padding ()

get_table_row_span ()

get_table_scope ()

get_table_summary ()

get_text (flags)

get_text_align ()

get_text_decoration_color ()

get_text_decoration_thickness ()

get_text_decoration_type ()

get_text_indent ()

get_text_spans ()

get_title ()

get_width ()

get_writing_mode ()

is_block ()

is_content ()

is_grouping ()

is_inline ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Poppler.StructureElement(**kwargs)
Bases:

GObject.Object

Abstract:

No

get_abbreviation()
Returns:

Text of the expanded abbreviation if the element text is an abbreviation or acrony, None if not.

Return type:

str

Acronyms and abbreviations contained in elements of type Poppler.StructureElementKind.SPAN may have an associated expanded text form, which can be retrieved using this function.

New in version 0.26.

get_actual_text()
Returns:

The actual text for the element, or None if not defined.

Return type:

str

Obtains the actual text enclosed by the element (and its child elements). The actual text is mostly used for non-text elements like images and figures which do have the graphical appearance of text, like a logo. For those the actual text is the equivalent text to those graphical elements which look like text when rendered.

Note that for elements containing proper text, the function Poppler.StructureElement.get_text() must be used instead.

New in version 0.26.

get_alt_text()
Returns:

The alternate text representation for the element, or None if not defined.

Return type:

str

Obtains the “alternate” text representation of the element (and its child elements). This is mostly used for non-text elements like images and figures, to specify a textual description of the element.

Note that for elements containing proper text, the function Poppler.StructureElement.get_text() must be used instead.

New in version 0.26.

get_background_color()
Returns:

True if a color is defined for the element, False otherwise.

color:

A Poppler.Color.

Return type:

(bool, color: Poppler.Color)

Obtains the background color of the element. If this attribute is not specified, the element shall be treated as if it were transparent.

New in version 0.26.

get_baseline_shift()
Returns:

A numeric value.

Return type:

float

Obtains how much the text contained in the inline-level structure element should be shifted, measuring from the baseline of the glyphs.

New in version 0.26.

get_block_align()
Returns:

A Poppler.StructureBlockAlign value.

Return type:

Poppler.StructureBlockAlign

Obtains the block-alignment mode of the block-level structure element.

New in version 0.26.

get_border_color()
Returns:

True if a color is defined for the element, False otherwise.

colors:

An array of four Poppler.Color.

Return type:

(bool, colors: [Poppler.Color])

Obtains the color of border around the element. The result values are in before-after-start-end ordering (for the typical Western left-to-right writing, that is top-bottom-left-right). If this attribute is not specified, the border color for this element shall be the current text fill color in effect at the start of its associated content.

New in version 0.26.

get_border_style()
Returns:

An array of four Poppler.StructureBorderStyle elements.

Return type:

border_styles: [Poppler.StructureBorderStyle]

Obtains the border style of a structure element. The result values are in before-after-start-end ordering. For example, using Western left-to-right writing, that is top-bottom-left-right.

New in version 0.26.

get_border_thickness()
Returns:

True if the border thickness attribute is defined for the element, False otherwise.

border_thicknesses:

Array with the four values of border thicknesses.

Return type:

(bool, border_thicknesses: [float])

Obtains the thickness of the border of an element. The result values are in before-after-start-end ordering (for the typical Western left-to-right writing, that is top-bottom-left-right). A value of 0 indicates that the border shall not be drawn.

New in version 0.26.

get_bounding_box()
Returns:

True if a bounding box is defined for the element, False otherwise.

bounding_box:

A Poppler.Rectangle.

Return type:

(bool, bounding_box: Poppler.Rectangle)

Obtains the size of the bounding box of a block-level structure element.

New in version 0.26.

get_color()
Returns:

True if a color is defined for the element, False otherwise.

color:

A Poppler.Color.

Return type:

(bool, color: Poppler.Color)

Obtains the color of the content contained in the element. If this attribute is not specified, the color for this element shall be the current text fill color in effect at the start of its associated content.

New in version 0.26.

get_column_count()
Returns:

Number of columns.

Return type:

int

Obtains the number of columns used to lay out the content contained in the grouping element.

New in version 0.26.

get_column_gaps()
Returns:

Array containing the values for the column gaps, or None if the array is empty or the attribute is not defined.

Return type:

[float]

Obtains the size of the gaps in between adjacent columns. Returns an array of elements: the first one is the size of the gap in between columns 1 and 2, second is the size between columns 2 and 3, and so on.

For elements which use a single column, None is returned and n_values is set to zero.

If the attribute is undefined, None is returned and n_values is set to a non-zero value.

The array with the results is allocated by the function. When it is not needed anymore, be sure to call GLib.free() on it.

New in version 0.26.

get_column_widths()
Returns:

Array containing widths of the columns, or None if the attribute is not defined.

Return type:

[float]

Obtains an array with the widths of the columns.

The array with the results is allocated by the function. When it is not needed anymore, be sure to call GLib.free() on it.

New in version 0.26.

get_end_indent()
Returns:

A numeric value.

Return type:

float

Obtains the amount of indentation at the end of the block-level structure element.

New in version 0.26.

get_form_description()
Returns:

A string, or None if the attribute is not defined.

Return type:

str

Obtains the textual description of the form element. Note that the description is for informative purposes, and it is not intended to be rendered. For example, assistive technologies may use the description field to provide an alternate way of presenting an element to the user.

The returned string is allocated by the function. When it is not needed anymore, be sure to call GLib.free() on it.

New in version 0.26.

get_form_role()
Returns:

A Poppler.StructureFormRole value.

Return type:

Poppler.StructureFormRole

Obtains the role of a form structure element that is part of a form, or is a form field. This hints how the control for the element is intended to be rendered.

New in version 0.26.

get_form_state()
Returns:

A Poppler.StructureFormState value.

Return type:

Poppler.StructureFormState

For a structure element that is a form field, obtains in which state the associated control is expected to be rendered.

New in version 0.26.

get_glyph_orientation()
Returns:

A Poppler.StructureGlyphOrientation value.

Return type:

Poppler.StructureGlyphOrientation

Obtains the glyph orientation for the text contained in a inline-level structure element.

New in version 0.26.

get_height()
Returns:

A positive value if a width is defined, or -1 if the height is to be calculated automatically.

Return type:

float

Obtains the height of the block-level structure element. Note that for elements which do not specify a height, it has to be calculated, and in this case -1 is returned.

New in version 0.26.

get_id()
Returns:

The identifier of the element (if defined), or None.

Return type:

str

Obtains the identifier of an element.

New in version 0.26.

get_inline_align()
Returns:

A Poppler.StructureInlineAlign value.

Return type:

Poppler.StructureInlineAlign

Obtains the inline-alignment mode of the block-level structure element.

New in version 0.26.

get_kind()
Returns:

A Poppler.StructureElementKind value.

Return type:

Poppler.StructureElementKind

New in version 0.26.

get_language()
Returns:

language and country code, or None.

Return type:

str

Obtains the language and country code for the content in an element, in two-letter ISO format, e.g. en_ES, or None if not defined.

New in version 0.26.

get_line_height()
Returns:

A positive value if a line height is defined, or -1 if the height is to be calculated automatically.

Return type:

float

Obtains the line height for the text contained in the inline-level structure element. Note that for elements which do not specify a line height, it has to be calculated, and in this case -1 is returned.

New in version 0.26.

get_list_numbering()
Returns:

A Poppler.StructureListNumbering value.

Return type:

Poppler.StructureListNumbering

Obtains the list numbering style for list items.

New in version 0.26.

get_padding()
Returns:

Padding for the four sides of the element.

Return type:

paddings: [float]

Obtains the padding of an element (space around it). The result values are in before-after-start-end ordering. For example using Western left-to-right writing, that is top-bottom-left-right.

New in version 0.26.

get_page()
Returns:

Number of the page that contains the element, of

-1 if not defined.

Return type:

int

Obtains the page number in which the element is contained.

New in version 0.26.

get_placement()
Returns:

A Poppler.StructurePlacement value.

Return type:

Poppler.StructurePlacement

Obtains the placement type of the structure element.

New in version 0.26.

get_ruby_align()
Returns:

A Poppler.StructureRubyAlign value.

Return type:

Poppler.StructureRubyAlign

Obtains the alignment for the ruby text contained in a inline-level structure element.

New in version 0.26.

get_ruby_position()
Returns:

A Poppler.StructureRubyPosition value.

Return type:

Poppler.StructureRubyPosition

Obtains the position for the ruby text contained in a inline-level structure element.

New in version 0.26.

get_space_after()
Returns:

A positive value.

Return type:

float

Obtains the amount of empty space after the block-level structure element.

New in version 0.26.

get_space_before()
Returns:

A positive value.

Return type:

float

Obtains the amount of empty space before the block-level structure element.

New in version 0.26.

get_start_indent()
Returns:

A numeric value.

Return type:

float

Obtains the amount of indentation at the beginning of the block-level structure element.

New in version 0.26.

get_table_border_style()
Returns:

An array of four Poppler.StructureBorderStyle elements.

Return type:

border_styles: [Poppler.StructureBorderStyle]

Obtains the table cell border style of a block-level structure element. The result values are in before-after-start-end ordering. For example, using Western left-to-right writing, that is top-bottom-left-right.

New in version 0.26.

get_table_column_span()
Returns:

A positive, non-zero value.

Return type:

int

Obtains the number of columns the table element spans to.

New in version 0.26.

get_table_headers()
Returns:

Zero-terminated array of strings with the table header names, or None if the attribute is not defined.

Return type:

[str]

Obtains an array with the names of the table column headers. This is only useful for table header row elements.

The array with the results is allocated by the function. The number of items in the returned array can be obtained with GLib.strv_length(). The returned value must be freed using GLib.strfreev().

New in version 0.26.

get_table_padding()
Returns:

Padding for the four sides of the element.

Return type:

paddings: [float]

Obtains the padding between the table cell’s content rectangle and the surrounding border of a block-level structure element. The result values are in before-after-start-end ordering (for the typical Western left-to-right writing, that is top-bottom-left-right).

New in version 0.26.

get_table_row_span()
Returns:

A positive, non-zero value.

Return type:

int

Obtains the number of rows the table element spans to.

New in version 0.26.

get_table_scope()
Returns:

A Poppler.StructureTableScope value.

Return type:

Poppler.StructureTableScope

Obtains the scope of a table structure element.

New in version 0.26.

get_table_summary()
Returns:

A string, or None if the attribute is not defined.

Return type:

str

Obtains the textual summary of the contents of the table element. Note that the summary is meant for informative purposes, and it is not intended to be rendered. For example, assistive technologies may use the description field to provide an alternate way of presenting an element to the user, or a document indexer may want to scan it for additional keywords.

The returned string is allocated by the function. When it is not needed anymore, be sure to call GLib.free() on it.

New in version 0.26.

get_text(flags)
Parameters:

flags (Poppler.StructureGetTextFlags) – A Poppler.StructureGetTextFlags value, or Poppler.StructureGetTextFlags.NONE to disable all the flags.

Returns:

A string.

Return type:

str

Obtains the text enclosed by an element, or the text enclosed by the elements in the subtree (including the element itself).

New in version 0.26.

get_text_align()
Returns:

A Poppler.StructureTextAlign value.

Return type:

Poppler.StructureTextAlign

Obtains the text alignment mode of the text contained into a block-level structure element.

New in version 0.26.

get_text_decoration_color()
Returns:

True if a color is defined for the element, False otherwise.

color:

A Poppler.Color.

Return type:

(bool, color: Poppler.Color)

Obtains the color of the text decoration for the text contained in the inline-level structure element. If this attribute is not specified, the color for this element shall be the current fill color in effect at the start of its associated content.

New in version 0.26.

get_text_decoration_thickness()
Returns:

Thickness of the text decoration, or NAN if not defined.

Return type:

float

Obtains the thickness of the text decoration for the text contained in the inline-level structure element. If this attribute is not specified, it shall be derived from the current stroke thickness in effect at the start of the element’s associated content.

New in version 0.26.

get_text_decoration_type()
Returns:

A Poppler.StructureTextDecoration value.

Return type:

Poppler.StructureTextDecoration

Obtains the text decoration type of the text contained in the inline-level structure element.

New in version 0.26.

get_text_indent()
Returns:

A numeric value.

Return type:

float

Obtains the amount of indentation of the text contained in the block-level structure element.

New in version 0.26.

get_text_spans()
Returns:

An array of Poppler.TextSpan elements.

Return type:

[Poppler.TextSpan]

Obtains the text enclosed by an element, as an array of Poppler.TextSpan structures. Each item in the list is a piece of text which share the same attributes, plus its attributes. The following example shows how to obtain and free the text spans of an element:

<informalexample><programlisting> int i, n_spans; Poppler.TextSpan **text_spans = Poppler.StructureElement.get_text_spans (element, &n_spans); /<!– –>* Use the text spans *<!– –>/ for (i = 0; i < n_spans; i++) Poppler.TextSpan.free (text_spans[i]); GLib.free (text_spans); </programlisting></informalexample>

New in version 0.26.

get_title()
Returns:

The title of the element, or None.

Return type:

str

Obtains the title of an element.

New in version 0.26.

get_width()
Returns:

A positive value if a width is defined, or -1 if the width is to be calculated automatically.

Return type:

float

Obtains the width of the block-level structure element. Note that for elements which do not specify a width, it has to be calculated, and in this case -1 is returned.

New in version 0.26.

get_writing_mode()
Returns:

A Poppler.StructureWritingMode value.

Return type:

Poppler.StructureWritingMode

Obtains the writing mode (writing direction) of the content associated with a structure element.

New in version 0.26.

is_block()
Returns:

True if the element is a block element, or False otherwise.

Return type:

bool

Checks whether an element is a block element.

New in version 0.26.

is_content()
Returns:

True if the element is content, or False otherwise.

Return type:

bool

Checks whether an element is actual document content.

New in version 0.26.

is_grouping()
Returns:

True if the element is a grouping element, False otherwise.

Return type:

bool

Checks whether an element is a grouping element.

New in version 0.26.

is_inline()
Returns:

True if the element is an inline element, or False otherwise.

Return type:

bool

Checks whether an element is an inline element.

New in version 0.26.