Page

Page class

Class representing page of PDF document.

The Page type exposes the following members:

Properties

NameDescription
is_add_paragraphs_after_lastGets or sets the addition of paragraphs after the last paragraph of the page
background_imageGets or sets background image for page (for generator only, not filled in when reading document).
toc_infoGets or sets table of contents info.
headerGets or sets page header.
layersGets or sets layers collection.
footerGets or sets page footer.
paragraphsGets the paragraphs.
page_infoGets or sets the page info (for generator only, not filled in when reading document).
rectGets or sets rectangle of the page.
For get: page crop box is returned if specified, otherwise page media box is returned.
For set: page media box always set.
Please note that this property don’t consider page rotation. To get page rectangle considering rotation please use ActualRect.
color_typeSets color type of the pages based on information getting from operators SetColor,
images and forms.
note_line_styleGets or sets the line style for notes.(for generator only, not filled in when reading document)
tab_orderGets or sets tab order of the page.
Possible values: Row, Column. Default, Manual
durationGets of set page display duration. This is time in seconds that page shall be displayed during presentation.
Returs -1 if duration is not defined.
contentsGets collection of operators in the content stream of the page.
OperatorCollection
groupGets or sets a group attributes class specifying the attributes of the page�s page group for use in the transparent imaging model.
annotationsGets collection of page annotations.
annotations
resourcesGets page resources. Resources object contains collections of images, forms and fonts.
resources
rotateGets or sets rotation of the page.
trim_boxGets or sets trim box of the page.
art_boxGets or sets art box of the page.
bleed_boxGets or sets bleed box of the page.
crop_boxGets or sets crop box of the page.
media_boxGets or sets media box of the page.
numberGet number of the page.
rotation_matrixGets transofmation matrix for the page.
backgroundGets or sets the background color of the page.
watermarkGets or sets the watermark of the page.
artifactsGets collection of artifacts on the page.
actionsGets collection of page properties.
fields_in_tab_orderGets list of Field object in Tab order on this page.
user_unitGets or sets UserUnit value. A positive number giving the size of default user space units, in multiples of 1 ⁄ 72 inch.
Default value is 1. Please set zero or negative value in order to clear this entry in page.

Methods

NameDescription
send_to(device, output)Sends page to process with given page device.
send_to(device, output_file_name)Sends page to process with given page device.
accept(visitor)Accepts AnnotationSelector visitor object that provides functionality to work with annotations.
accept(visitor)Accepts TextFragmentAbsorber visitor object that provides functionality to work with text objects.
accept(visitor)Accepts ImagePlacementAbsorber visitor object that provides functionality to work with image placement objects.
accept(visitor)Accepts TextAbsorber visitor object that provides functionality to work with text objects.
add_image(image_stream, image_rect)Adds image onto the page and locates it in the middle of specified rectangle saving image’s proportion.
add_image(hocr, image_stream, image_rect)Adds searchable image onto the page and locates it in the middle of specified rectangle saving image’s proportion.
add_image(image_stream, image_rect, image_width, image_height, save_image_proportions)Adds image on page and places it depend on image rectangle position.
add_image(image_path, rectangle)Adds searchable image onto the page and locates it in the middle of specified rectangle saving image’s proportion.
is_blank(fill_threshold_factor)Gets the flag whether page is blank or not.
get_page_rect(consider_rotation)Returns rectangle of the page according to its CropBox (or MediaBox if CropBox null).
calculate_content_b_box()Calculates bbox value - rectangle containing contents without visible margins.
rotation_to_int(rotation)Translates rotation enumeration member into integer value.
int_to_rotation(rotation)Translates integer value into corresponding rotation enumeration member.
add_stamp(stamp)Put stamp into page. Stamp can be page number, image or simple text, e.g. some logo.
flatten()Removes all fields located on the page and place their values instead.
set_page_size(width, height)Sets page size for page.
make_grayscale()Converts the page to grayscale.
free_memory()Clears cached data
get_notifications()Returns notifications about inside operations with page content. (Only notifications about paragraph events in text adding scenarios are supported now.)
as_byte_array(resolution)Converts current page as bitmap and than returns array of bytes.
as_xml()Converts current page as xml in utf8 encoding.

See Also