Page methods reference

ExtractText2(left, top, right, bottom)

Returns the text located inside the region bounded by the left, top, right and bottom parameters. If multiple lines are found, they are separated by a CR-LF pair.

Syntax

ExtractText2(left, top, right, bottom)

left

Float. Distance in inches of the left limit of the region from the left edge of the Cropbox object (/CropBox). Must be between 0 and 5000.

top

Float. Distance in inches of the top limit of the region from the top edge of the Cropbox object (/CropBox). Must be between 0 and 5000.

right

Float. Distance in inches of the right limit of the region from the left edge of the Cropbox object (/CropBox). Must be between 0 and 5000.

bottom

Float. Distance in inches of the bottom limit of the region from the top edge of the Cropbox object (/CropBox). Must be between 0 and 5000.

Return value

A string containing the text extracted from the specified region.

MediaSize()

Returns the size of the physical medium on which the page is intended to be placed, in points. This corresponds to the Mediabox object (/MediaBox) entry of the Page object (/Page) in the PDF. See also: Size().

Syntax

MediaSize()

Return value

A PdfRect structure containing the dimensions, in points, of the media size. Cannot be undefined (null).

setIncludeBorders(pbIncludeBorders)

Sets whether or not borders are included for Page.ExtractText2(). If true, a character is considered to be inside the region using the 30% rule (i.e. at least 30% of the character must be enclosed in the region). Otherwise, the character must be entirely enclosed in the region to be returned. See also: ExtractText2(left, top, right, bottom).

Syntax

setIncludeBorders(pbIncludeBorders)

pbIncludeBorders

Boolean. If true (zero), the char must be completely inside the region. Otherwise, the 30% rule applies.

Merge(imageFile, left, top, rotateAngle, scaleFactor)

Inserts an image file and places it on the page at a specific location.
Supported image types are: JPG and PNG. It calls MergeToLayer internally.

Syntax

Merge( imageFile, left, top, rotateAngle, scaleFactor)

imageFile

String. Full name of the image to insert on the current page.

left

Float. Coordinate at which to place the left edge of the image from the left edge of the page, in points.

top

Float. Coordinate at which to place the top edge of the image from the top of the page, in points.

rotateAngle

Float. Angle at which to rotate counter-clockwise the inserted image, in degrees. The rotation is done after the image is placed at (left, top) and centered around that point.

scaleFactor

Float. Scale at which to display the image. For bitmaps, this is based on a 72 dpi resolution. Use 1.0 for the nominal size.

Merge2(srcPage, left, top, rotateAngle, scaleFactor)

Transparently places a PDF page on top of the current page at a specific location. The source page can be either from the same PDF or another opened file. If the source is from the same PDF file, the source page is not modified. This allows to have the same behavior as PDF.MergeWith() by first inserting the pages from an external file, merging them and then deleting them, but with more flexibility.

Syntax

Merge2(srcPage, left, top, rotateAngle, scaleFactor)

srcPage

Page object to overlay on the current page.

left

Float. Coordinate at which to place the left edge of the image from the left edge of the page, in points.

top

Float. Coordinate at which to place the top edge of the image from the top of the page, in points.

rotateAngle

Float. Angle at which to rotate counter-clockwise the inserted image, in degrees. The rotation is done after the image is placed at (left, top) and centered around that point.

scaleFactor

Float. Scale at which to display the image. For bitmaps, this is based on a 72 dpi resolution. Use 1.0 for the nominal size.

MergeToLayer(imageFile, left, top, rotateAngle, scaleFactor, layerName)

This method behaves the same as Merge() but allows to insert the image as a layer (aka an Optional Content Group).

Supported image types are JPG and PNG. If the input file is a PNG with an alpha channel, the PNG is alpha blended with the page underneath. Monochrome PNG files are drawn transparently, with the white used as the transparent color.

Syntax

MergeToLayer(imageFile, left, top, rotateAngle, scaleFactor, layerName)

imageFile

String. Full name of the image to insert on the current page.

left

Float. Coordinate at which to place the left edge of the image from the left edge of the page, in points.

top

Float. Coordinate at which to place the top edge of the image from the top of the page, in points.

rotateAngle

Float. Angle at which to rotate counter-clockwise the inserted image, in degrees. The rotation is done after the image is placed at (left, top) and centered around that point.

scaleFactor

Float. Scale at which to display the image. For bitmaps, this is based on a 72 dpi resolution. Use 1.0 for the nominal size.

layerName

String. Name of an Optional Content Group in which to put the layer containing the image. The string cannot be empty but can be undefined (null) if no layer is required.

MergeToLayer2(srcPage, left, top, rotateAngle, scaleFactor, layerName)

This method behaves the same as Merge2() but allows to put the source page as a layer (aka an Optional Content Group).

Syntax

MergeToLayer2(srcPage, left, top, rotateAngle, scaleFactor, layerName)

srcPage

Page object to overlay on the current page.

left

Float. Coordinate at which to place the left edge of the image from the left edge of the page, in points.

top

Float. Coordinate at which to place the top edge of the image from the top of the page, in points.

rotateAngle

Float. Angle at which to rotate counter-clockwise the inserted image, in degrees. The rotation is done after the image is placed at (left, top) and centered around that point.

scaleFactor

Float. Scale at which to display the image. For bitmaps, this is based on a 72 dpi resolution. Use 1.0 for the nominal size.

layerName

String. Name of an Optional Content Group in which to put the layer created from the source page. The string cannot be empty but can be undefined (null) if no layer is required.

Size()

Returns the size of the rectangle that is used to clip (crop) the content of the page before applying it to the medium, in points. This corresponds to the Cropbox object (/CropBox) entry of the Page PDF object (/Page). It can be seen as the bounding box of the page since by definition, anything outside of it should be left out of the drawing, although there may be empty areas within it.
See also: MediaSize().

Syntax

Size()

Return value

A PdfRect structure containing the dimensions, in points, of the page size. Cannot be undefined (null).