Class: Poppler::StructureElement

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#abbreviationString

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

Returns:

  • (String)

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

#actual_textString

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_structure_element_get_text() must be used instead.

Returns:

  • (String)

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

#alt_textString

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_structure_element_get_text() must be used instead.

Returns:

  • (String)

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

#baseline_shiftFloat

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

Returns:

  • (Float)

    A numeric value.

#block_alignPoppler::StructureBlockAlign

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

Returns:

#column_countInteger

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

Returns:

  • (Integer)

    Number of columns.

#end_indentFloat

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

Returns:

  • (Float)

    A numeric value.

#form_descriptionString

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 g_free() on it.

Returns:

  • (String)

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

#form_rolePoppler::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.

Returns:

#form_statePoppler::StructureFormState

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

Returns:

#get_background_color(color) ⇒ Boolean

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

Parameters:

Returns:

  • (Boolean)

    true if a color is defined for the element, false otherwise.

#get_border_color(colors) ⇒ Boolean

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.

Parameters:

Returns:

  • (Boolean)

    true if a color is defined for the element, false otherwise.

#get_border_style(border_styles) ⇒ nil

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.

Parameters:

Returns:

  • (nil)

#get_border_thickness(border_thicknesses) ⇒ Boolean

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.

Parameters:

  • border_thicknesses (Array<Float>)

    Array with the four values of border thicknesses.

Returns:

  • (Boolean)

    true if the border thickness attribute is defined for the element, false otherwise.

#get_bounding_box(bounding_box) ⇒ Boolean

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

Parameters:

Returns:

  • (Boolean)

    true if a bounding box is defined for the element, false otherwise.

#get_color(color) ⇒ Boolean

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.

Parameters:

Returns:

  • (Boolean)

    true if a color is defined for the element, false otherwise.

#get_column_gaps(n_values) ⇒ Array<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, nil is returned and n_values is set to zero.

If the attribute is undefined, nil 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 g_free() on it.

Parameters:

  • n_values (Integer)

    Size of the returned array.

Returns:

  • (Array<Float>)

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

#get_column_widths(n_values) ⇒ Array<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 g_free() on it.

Parameters:

  • n_values (Integer)

    Size of the returned array.

Returns:

  • (Array<Float>)

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

#get_padding(paddings) ⇒ nil

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.

Parameters:

  • paddings (Array<Float>)

    Padding for the four sides of the element.

Returns:

  • (nil)

#get_table_border_style(border_styles) ⇒ nil

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.

Parameters:

Returns:

  • (nil)

#get_table_padding(paddings) ⇒ nil

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).

Parameters:

  • paddings (Array<Float>)

    Padding for the four sides of the element.

Returns:

  • (nil)

#get_text(flags) ⇒ String

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

Parameters:

Returns:

  • (String)

    A string.

#get_text_decoration_color(color) ⇒ Boolean

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.

Parameters:

Returns:

  • (Boolean)

    true if a color is defined for the element, false otherwise.

#get_text_spans(n_text_spans) ⇒ Array<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:

guint i, n_spans; PopplerTextSpan *text_spans = poppler_structure_element_get_text_spans (element, &n_spans); / Use the text spans */ for (i = 0; i < n_spans; i++) poppler_text_span_free (text_spans[i]); g_free (text_spans);

Parameters:

  • n_text_spans (Integer)

    A pointer to the location where the number of elements in the returned array will be stored.

Returns:

  • (Array<Poppler::TextSpan>)

    An array of Poppler::TextSpan elements.

#glyph_orientationPoppler::StructureGlyphOrientation

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

Returns:

#heightFloat

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.

Returns:

  • (Float)

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

#idString

Obtains the identifier of an element.

Returns:

  • (String)

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

#inline_alignPoppler::StructureInlineAlign

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

Returns:

#is_blockBoolean

Checks whether an element is a block element.

Returns:

  • (Boolean)

    true if the element is a block element, or false otherwise.

#is_contentBoolean

Checks whether an element is actual document content.

Returns:

  • (Boolean)

    true if the element is content, or false otherwise.

#is_groupingBoolean

Checks whether an element is a grouping element.

Returns:

  • (Boolean)

    true if the element is a grouping element, false otherwise.

#is_inlineBoolean

Checks whether an element is an inline element.

Returns:

  • (Boolean)

    true if the element is an inline element, or false otherwise.

#kindPoppler::StructureElementKind

Returns A Poppler::StructureElementKind value.

Returns:

#languageString

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

Returns:

  • (String)

    language and country code, or nil.

#line_heightFloat

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.

Returns:

  • (Float)

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

#list_numberingPoppler::StructureListNumbering

Obtains the list numbering style for list items.

Returns:

#pageInteger

Obtains the page number in which the element is contained.

Returns:

  • (Integer)

    Number of the page that contains the element, of -1 if not defined.

#placementPoppler::StructurePlacement

Obtains the placement type of the structure element.

Returns:

#ruby_alignPoppler::StructureRubyAlign

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

Returns:

#ruby_positionPoppler::StructureRubyPosition

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

Returns:

#space_afterFloat

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

Returns:

  • (Float)

    A positive value.

#space_beforeFloat

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

Returns:

  • (Float)

    A positive value.

#start_indentFloat

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

Returns:

  • (Float)

    A numeric value.

#table_column_spanInteger

Obtains the number of columns the table element spans to.

Returns:

  • (Integer)

    A positive, non-zero value.

#table_headersArray<String>

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 g_strv_length(). The returned value must be freed using g_strfreev().

Returns:

  • (Array<String>)

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

#table_row_spanInteger

Obtains the number of rows the table element spans to.

Returns:

  • (Integer)

    A positive, non-zero value.

#table_scopePoppler::StructureTableScope

Obtains the scope of a table structure element.

Returns:

#table_summaryString

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 g_free() on it.

Returns:

  • (String)

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

#text_alignPoppler::StructureTextAlign

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

Returns:

#text_decoration_thicknessFloat

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.

Returns:

  • (Float)

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

#text_decoration_typePoppler::StructureTextDecoration

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

Returns:

#text_indentFloat

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

Returns:

  • (Float)

    A numeric value.

#titleString

Obtains the title of an element.

Returns:

  • (String)

    The title of the element, or nil.

#widthFloat

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.

Returns:

  • (Float)

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

#writing_modePoppler::StructureWritingMode

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

Returns: