Poppler.Page¶
- Subclasses:
 None
Methods¶
- Inherited:
 - Structs:
 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
class  | 
  | 
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
|
  | 
Virtual Methods¶
- Inherited:
 
Properties¶
Name  | 
Type  | 
Flags  | 
Short Description  | 
|---|---|---|---|
r  | 
The label of the page  | 
Signals¶
- Inherited:
 
Fields¶
- Inherited:
 
Class Details¶
- class Poppler.Page(**kwargs)¶
 - Bases:
 - Abstract:
 No
- classmethod free_annot_mapping(list)¶
 - Parameters:
 list ([
Poppler.AnnotMapping]) – A list ofPoppler.AnnotMappings
Frees a list of
Poppler.AnnotMappings allocated byPoppler.Page.get_annot_mapping(). It also unreferences thePoppler.Annots that each mapping contains, so if you want to keep them around, you need to reference them withGObject.Object.ref().
- classmethod free_form_field_mapping(list)¶
 - Parameters:
 list ([
Poppler.FormFieldMapping]) – A list ofPoppler.FormFieldMappings
Frees a list of
Poppler.FormFieldMappings allocated byPoppler.Page.get_form_field_mapping().
- classmethod free_image_mapping(list)¶
 - Parameters:
 list ([
Poppler.ImageMapping]) – A list ofPoppler.ImageMappings
Frees a list of
Poppler.ImageMappings allocated byPoppler.Page.get_image_mapping().
- classmethod free_link_mapping(list)¶
 - Parameters:
 list ([
Poppler.LinkMapping]) – A list ofPoppler.LinkMappings
Frees a list of
Poppler.LinkMappings allocated byPoppler.Page.get_link_mapping(). It also frees thePoppler.Actions that each mapping contains, so if you want to keep them around, you need to copy them withPoppler.Action.copy().
- classmethod free_text_attributes(list)¶
 - Parameters:
 list ([
Poppler.TextAttributes]) – A list ofPoppler.TextAttributess
Frees a list of
Poppler.TextAttributess allocated byPoppler.Page.get_text_attributes().New in version 0.18.
- classmethod selection_region_free(region)¶
 - Parameters:
 region ([
Poppler.Rectangle]) – aGLib.ListofPoppler.Rectangle
Frees region
Deprecated since version 0.16: Use only to free deprecated regions created by
Poppler.Page.get_selection_region(). Regions created byPoppler.Page.get_selected_region() should be freed with cairo_region_destroy() instead.
- add_annot(annot)¶
 - Parameters:
 annot (
Poppler.Annot) – aPoppler.Annotto add
Adds annotation annot to self.
New in version 0.16.
- find_text(text)¶
 - Parameters:
 text (
str) – the text to search for (UTF-8 encoded)- Returns:
 a
GLib.ListofPoppler.Rectangle,- Return type:
 
Finds text in self with the default options (
Poppler.FindFlags.DEFAULT) and returns aGLib.Listof rectangles for each occurrence of the text on the page. The coordinates are in PDF points.
- find_text_with_options(text, options)¶
 - Parameters:
 text (
str) – the text to search for (UTF-8 encoded)options (
Poppler.FindFlags) – find options
- Returns:
 a newly allocated list of newly allocated
Poppler.Rectangle. Free with g_list_free_full() usingPoppler.Rectangle.free().- Return type:
 
Finds text in self with the given
Poppler.FindFlagsoptions and returns aGLib.Listof rectangles for each occurrence of the text on the page. The coordinates are in PDF points.When
Poppler.FindFlags.MULTILINEis passed in options, matches may span more than one line. In this case, the returned list will contain onePoppler.Rectanglefor each part of a match. The functionPoppler.Rectangle.find_get_match_continued() will returnTruefor all rectangles belonging to the same match, except for the last one. If a hyphen was ignored at the end of the part of the match,Poppler.Rectangle.find_get_ignored_hyphen() will returnTruefor that rectangle.Note that currently matches spanning more than two lines are not found. (This limitation may be lifted in a future version.)
Note also that currently finding multi-line matches backwards is not implemented; if you pass
Poppler.FindFlags.BACKWARDSandPoppler.FindFlags.MULTILINEtogether,Poppler.FindFlags.MULTILINEwill be ignored.New in version 0.22.
- get_annot_mapping()¶
 - Returns:
 - Return type:
 
Returns a list of
Poppler.AnnotMappingitems that map from a location on self to aPoppler.Annot. This list must be freed withPoppler.Page.free_annot_mapping() when done.
- get_bounding_box(rect)¶
 - Parameters:
 rect (
Poppler.Rectangle) –- Return type:
 
- get_crop_box()¶
 - Returns:
 a
Poppler.Rectangleto fill- Return type:
 rect:
Poppler.Rectangle
Retrurns the crop box of self
- get_duration()¶
 - Returns:
 duration in seconds of self or -1.
- Return type:
 
Returns the duration of self
- get_form_field_mapping()¶
 - Returns:
 - Return type:
 
Returns a list of
Poppler.FormFieldMappingitems that map from a location on self to a form field. This list must be freed withPoppler.Page.free_form_field_mapping() when done.
- get_image(image_id)¶
 - Parameters:
 image_id (
int) – The image identifier- Returns:
 A cairo surface for the image
- Return type:
 
Returns a cairo surface for the image of the self
- get_image_mapping()¶
 - Returns:
 - Return type:
 
Returns a list of
Poppler.ImageMappingitems that map from a location on self to an image of the page. This list must be freed withPoppler.Page.free_image_mapping() when done.
- get_label()¶
 - Returns:
 a new allocated string containing the label of self, or
Noneif self doesn’t have a label- Return type:
 
Returns the label of self. Note that page labels and page indices might not coincide.
New in version 0.16.
- get_link_mapping()¶
 - Returns:
 - Return type:
 
Returns a list of
Poppler.LinkMappingitems that map from a location on self to aPoppler.Action. This list must be freed withPoppler.Page.free_link_mapping() when done.
- get_selected_region(scale, style, selection)¶
 - Parameters:
 scale (
float) – scale specified as pixels per pointstyle (
Poppler.SelectionStyle) – aPoppler.SelectionStyleselection (
Poppler.Rectangle) – start and end point of selection as a rectangle
- Returns:
 - Return type:
 
Returns a region containing the area that would be rendered by
Poppler.Page.render_selection(). The returned region must be freed with cairo_region_destroy()New in version 0.16.
- get_selected_text(style, selection)¶
 - Parameters:
 style (
Poppler.SelectionStyle) – aPoppler.SelectionStyleselection (
Poppler.Rectangle) – thePoppler.Rectangleincluding the text
- Returns:
 a pointer to the contents of the selection as a string
- Return type:
 
Retrieves the contents of the specified selection as text.
New in version 0.16.
- get_selection_region(scale, style, selection)¶
 - Parameters:
 scale (
float) – scale specified as pixels per pointstyle (
Poppler.SelectionStyle) – aPoppler.SelectionStyleselection (
Poppler.Rectangle) – start and end point of selection as a rectangle
- Returns:
 - Return type:
 
Returns a region containing the area that would be rendered by
Poppler.Page.render_selection() as aGLib.ListofPoppler.Rectangle. The returned list must be freed withPoppler.Page.selection_region_free().Deprecated since version 0.16: Use
Poppler.Page.get_selected_region() instead.
- get_size()¶
 - Returns:
 - width:
 return location for the width of self
- height:
 return location for the height of self
- Return type:
 
Gets the size of self at the current scale and rotation.
- get_text()¶
 - Returns:
 a pointer to the text of the self as a string
- Return type:
 
Retrieves the text of self.
New in version 0.16.
- get_text_attributes()¶
 - Returns:
 - Return type:
 
Obtains the attributes of the text as a
GLib.ListofPoppler.TextAttributes. This list must be freed withPoppler.Page.free_text_attributes() when done.Each list element is a
Poppler.TextAttributesstruct where start_index and end_index indicates the range of text (as returned byPoppler.Page.get_text()) to which text attributes apply.See also
Poppler.Page.get_text_attributes_for_area()New in version 0.18.
- get_text_attributes_for_area(area)¶
 - Parameters:
 area (
Poppler.Rectangle) – aPoppler.Rectangle- Returns:
 - Return type:
 
Obtains the attributes of the text in area as a
GLib.ListofPoppler.TextAttributes. This list must be freed withPoppler.Page.free_text_attributes() when done.Each list element is a
Poppler.TextAttributesstruct where start_index and end_index indicates the range of text (as returned byPoppler.Page.get_text_for_area()) to which text attributes apply.New in version 0.26.
- get_text_for_area(area)¶
 - Parameters:
 area (
Poppler.Rectangle) – aPoppler.Rectangle- Returns:
 a pointer to the text as a string
- Return type:
 
Retrieves the text of self contained in area.
New in version 0.26.
- get_text_layout()¶
 - Returns:
 Trueif the page contains text,Falseotherwise- rectangles:
 return location for an array of
Poppler.Rectangle
- Return type:
 (
bool, rectangles: [Poppler.Rectangle])
Obtains the layout of the text as a list of
Poppler.RectangleThis array must be freed withGLib.free() when done.The position in the array represents an offset in the text returned by
Poppler.Page.get_text()See also
Poppler.Page.get_text_layout_for_area().New in version 0.16.
- get_text_layout_for_area(area)¶
 - Parameters:
 area (
Poppler.Rectangle) – aPoppler.Rectangle- Returns:
 Trueif the page contains text,Falseotherwise- rectangles:
 return location for an array of
Poppler.Rectangle
- Return type:
 (
bool, rectangles: [Poppler.Rectangle])
Obtains the layout of the text contained in area as a list of
Poppler.RectangleThis array must be freed withGLib.free() when done.The position in the array represents an offset in the text returned by
Poppler.Page.get_text_for_area()New in version 0.26.
- get_thumbnail()¶
 - Returns:
 the tumbnail as a
cairo.SurfaceorNoneif the document doesn’t have a thumbnail for this page.- Return type:
 
Get the embedded thumbnail for the specified page. If the document doesn’t have an embedded thumbnail for the page, this function returns
None.
- get_thumbnail_size()¶
 - Returns:
 True, if self has a thumbnail associated with it.- width:
 return location for width
- height:
 return location for height
- Return type:
 
Returns
Trueif self has a thumbnail associated with it. It also fills in width and height with the width and height of the thumbnail. The values of width and height are not changed if no appropriate thumbnail exists.
- get_transition()¶
 - Returns:
 a
Poppler.PageTransitionorNone.- Return type:
 
Returns the transition effect of self
- remove_annot(annot)¶
 - Parameters:
 annot (
Poppler.Annot) – aPoppler.Annotto remove
Removes annotation annot from self
New in version 0.22.
- render(cairo)¶
 - Parameters:
 cairo (
cairo.Context) – cairo context to render to
Render the page to the given cairo context. This function is for rendering a page that will be displayed. If you want to render a page that will be printed use
Poppler.Page.render_for_printing() instead. Please see the documentation for that function for the differences between rendering to the screen and rendering to a printer.
- render_for_printing(cairo)¶
 - Parameters:
 cairo (
cairo.Context) – cairo context to render to
Render the page to the given cairo context for printing with
Poppler.PrintFlags.ALLflags selected. If you want a different set of flags, usePoppler.Page.render_full() with printingTrueand the corresponding flags.The difference between
Poppler.Page.render() and this function is that some things get rendered differently between screens and printers:PDF annotations get rendered according to their
Poppler.AnnotFlagvalue. For example,Poppler.AnnotFlag.PRINTrefers to whether an annotation is printed or not, whereasPoppler.AnnotFlag.NO_VIEWrefers to whether an annotation is invisible when displaying to the screen.PDF supports “hairlines” of width 0.0, which often get rendered as having a width of 1 device pixel. When displaying on a screen, Cairo may render such lines wide so that they are hard to see, and Poppler makes use of PDF’s Stroke Adjust graphics parameter to make the lines easier to see. However, when printing, Poppler is able to directly use a printer’s pixel size instead.
Some advanced features in PDF may require an image to be rasterized before sending off to a printer. This may produce raster images which exceed Cairo’s limits. The “printing” functions will detect this condition and try to down-scale the intermediate surfaces as appropriate.
- render_for_printing_with_options(cairo, options)¶
 - Parameters:
 cairo (
cairo.Context) – cairo context to render tooptions (
Poppler.PrintFlags) – print options
Render the page to the given cairo context for printing with the specified options
See the documentation for
Poppler.Page.render_for_printing() for the differences between rendering to the screen and rendering to a printer.New in version 0.16.
Deprecated since version 25.02: Use
Poppler.Page.render_full() instead.
- render_full(cairo, printing, flags)¶
 - Parameters:
 cairo (
cairo.Context) – cairo context to render toprinting (
bool) – cairo context to render toflags (
Poppler.RenderAnnotsFlags) – flags which allow to select which annotations to render
Render the page to the given cairo context, manually selecting which annotations should be displayed.
The printing parameter determines whether a page is rendered for printing or for displaying it on a screen. See the documentation for
Poppler.Page.render_for_printing() for the differences between rendering to the screen and rendering to a printer.New in version 25.02.
- render_selection(cairo, selection, old_selection, style, glyph_color, background_color)¶
 - Parameters:
 cairo (
cairo.Context) – cairo context to render toselection (
Poppler.Rectangle) – start and end point of selection as a rectangleold_selection (
Poppler.Rectangle) – previous selectionstyle (
Poppler.SelectionStyle) – aPoppler.SelectionStyleglyph_color (
Poppler.Color) – color to use for drawing glyphsbackground_color (
Poppler.Color) – color to use for the selection background
Render the selection specified by selection for self to the given cairo context. The selection will be rendered, using glyph_color for the glyphs and background_color for the selection background.
If non-
None, old_selection specifies the selection that is already rendered to cairo, in which case this function will (some day) only render the changed part of the selection.
- render_to_ps(ps_file)¶
 - Parameters:
 ps_file (
Poppler.PSFile) – thePoppler.PSFileto render to
Render the page on a postscript file