FoxitPDFSDKforWeb  8.3.0
Foxit PDF SDK for Web
PDFPage Class Reference

Public Member Functions

 addAnnot (annotJson)
 Add an annotation into the current page. This method may add an annotation along with an associated annotation like popup. [Support in Server] More...
 
 addAnnotGroup (annotJsons, headerIndex)
 Add a group annotation into the current page. This method may add an annotation along with an associated annotation like popup. [Support in Server] More...
 
 addGraphicsObject (info)
 Add a new graphics object to the page. More...
 
 addImage (imageBuffer, rect, rotation=0)
 Add the image to page. More...
 
 addWatermark (data)
 Add a page watermark. More...
 
 flatten (option)
 Flatten all annotations and interactive form fields in a Page. More...
 
 getAnnotCount ()
 Gets the total amount of all annotations in a specified page. [Support in Server] More...
 
 getAnnotIdAtDevicePoint (point, tolerance, matrix)
 Get the specified position of an annotation in device page coordinate. [Support in Server] More...
 
 getAnnotObjectNumAtDevicePoint (point, tolerance, matrix)
 Get the specified position of an annotation in device page coordinate. [Support in Server] More...
 
 getAnnots (reload=false)
 Get an array of all annotations in a page. [Support in Server] More...
 
 getAnnotsByIdArray (ids)
 Get an array of page annotation ID which can be obtained by Annot::getUniqueID(). [Support in Server] More...
 
 getAnnotsByObjectNumArray (objNums)
 Get an array of page annotation object number which can be obtained by Annot::getObjectNumber(). [Support in Server] More...
 
 getAnnotTree ()
 Get a structrual tree of all annotations in a specified page. [Support in Server] More...
 
 getCharInfoAtPoint (point, tolerance=0)
 Get character information at a specified position, in PDF coordination system. More...
 
 getDeviceMatrix (rotate=0)
 Get the device matrix for the page. [Support in Server] More...
 
 getDevicePoint (point, scale=1, rotate=0)
 Convert PDF coordinates to device coordinates for the page. [Support in Server] More...
 
 getDeviceRect (pdfRect, scale=1, rotate=0)
 Convert PDFRect to deviceRect [Support in Server] More...
 
 getDict ()
 Get the dictionary of the pdf page. More...
 
 getGraphicsObjectAtPoint (point, tolerance, type)
 Get graphics object at the specified point on the page. More...
 
 getGraphicsObjectByIndex (index)
 Get page graphics object by Index. More...
 
 getGraphicsObjectsCount ()
 Get the count of the graphics objects on the page. More...
 
 getGraphicsObjectsInRect (rect, tolerance, type)
 Get graphics objects of the specified rectangle on the page. More...
 
 getHeight ()
 Get page height. [Support in Server] More...
 
 getIndex ()
 Get page's index. More...
 
 getMarkupAnnots ()
 Get only markup annotations in the current page. [Support in Server] More...
 
 getPageBox (boxType)
 Get page box rectangle (in PDF coordinate system). More...
 
 getPDFDoc ()
 Get the document object [Support in Server] More...
 
 getPDFMatrix ()
 Get page matrix [Support in Server] More...
 
 getRotation ()
 Get page rotation angle. More...
 
 getRotationAngle ()
 Get page rotation angle. [Support in Server] More...
 
 getSnappedPoint (point, mode)
 Get the snap point based on the given point and snap mode which should be passed as array. More...
 
 getTextRectsAtRect (rect)
 Get page text rectangles in specified rectangle. [Support in Server] More...
 
 getTextSearch (pattern, flags)
 Get PageTextSearch with specified pattern and flags. [Support in Server] More...
 
 getThumb (rotate=0, ratio=1)
 Get the PDF stream of "Thumb". [Support in Server] More...
 
 getWidth ()
 Get page width. [Support in Server] More...
 
 isCropped ()
 Use CropBox to determine whether the page is cropped. More...
 
 isScannedPage ()
 
 isVirtual ()
 Some PDF pages are generated without necessary dictionary entries, and can’t be rendered and processed properly in a standard PDF reader. These non-standard pages are marked as virtual pages in our Web SDK. To render this type of pages correctly without causing any errors, you should call this API to detect virtual pages when these pages are in focus and disable actions such as widget creation, PPO, Action, Redaction, and so on. More...
 
 markRedactAnnot (rects)
 Mark page contents (text object, image object, and path object) which are to be redacted. More...
 
 removeAllAnnot ()
 Remove all annotations from the current page. [Support in Server] More...
 
 removeAnnotById (id)
 Remove an annotation by ID from the current page. The ID can be obtained by Annot::getUniqueID(). [Support in Server] More...
 
 removeAnnotByObjectNumber (objNum)
 Remove an annotation by object number from the current page. The object number can be obtained by Annot::getObjectNumber(). [Support in Server] More...
 
 removeGraphicsObject (obj)
 Remove the specified graphic object. More...
 
 render (scale, rotate, area, contentsFlags=['page'], usage='view')
 Get page bitmap. [Support in Server] More...
 
 reverseDeviceOffset (offset, scale=1, rotate=0)
 Convert PDF device page offset to PDF page offset. [Support in Server] More...
 
 reverseDevicePoint (point, scale=1, rotate=0)
 Transform PDF page point device coordinate to PDF page coordinate. [Support in Server] More...
 
 reverseDeviceRect (pdfRect, scale=1, rotate=0)
 Transform PDF page device rectangle to PDF page rectangle. [Support in Server] More...
 
 setRotation (rotation)
 

Detailed Description

PDF page object

Member Function Documentation

◆ addAnnot()

PDFPage::addAnnot (   annotJson)
inline

Add an annotation into the current page. This method may add an annotation along with an associated annotation like popup. [Support in Server]

Note
If add a stamp annot with default annotation icon(icon and iconCategory are specified), please call PDFViewer.initAnnotationIcons(icons) to set default annotation icons.
PDFViewer.initAnnotationIcons(icons) is not support in Server.
Parameters
annotJson{object} - JSON object which indicates annotation's properties.
annotJson.type{String} The type of annotation to be added. Support type:
annotJson.rect{Object} Rectangle of the new annotation.{all}
annotJson.rect.left{Number} The x-coordinate of the input left-bottom corner.
annotJson.rect.bottom{Number} The y-coordinate of the input left-bottom corner.
annotJson.rect.right{Number} The x-coordinate of the input right-top corner.
annotJson.rect.top{Number} The y-coordinate of the input right-top corner.
[annotJson.borderInfo]{Object} set border information.{all}[optional]
[annotJson.borderInfo.width]{Number} Border width.{all}[optional]
[annotJson.borderInfo.style]{Number} Border style.Style {0:"Solid", 1:"Dashed", 2:"UnderLine", 3:"Beveled",4:"Inset", 5:"Cloudy"}.{all}[optional]
[annotJson.borderInfo.cloudIntensity]{Number} Intensity of the cloudy effect.Only useful when parameter style is "Cloudy".{all}[optional] Valid value range: 0 to 2. 0 means no cloudy border effect. If the value is below 0, it will have the same effect as value 0. If the value is above 2, it will have the same effect as value 2.
[annotJson.borderInfo.dashPhase]{Number} Dash phase.Only useful when parameter style is "Dashed".{all}[optional]
[annotJson.borderInfo.dashes]{Array} A dash array that represents the dash patterns.Only useful when parameter style is "Dashed".{all}[optional]
[annotJson.alignment]{Number} Set alignment value. Alignment { 0:"AlignmentLeft", 1:"AlignmentCenter", 2:"AlignmentRight" } {freetext}[optional]
[annotJson.buffer]{Uint8Array} The buffer of file.{fileattachment,screen}
[annotJson.calloutLinePoints]{Array} Only when the intent name of a free text annotation is "FreeTextCallout", this free text annotation can have callout line points property, and this property has effect on this kind of free text annotation's appearance.{freetext}[optional]
[annotJson.calloutLineEndingStyle]{Number} Only when the intent name of a free text annotation is "FreeTextCallout", this free text annotation can have callout line points property, and this property has effect on this kind of free text annotation's appearance. Please refer to Ending_Style. {freetext && FreeTextCallout}[optional]
[annotJson.color]{String} New border color to be set.Format: 0xRRGGBB.{all}[optional]
[annotJson.contents]{String} New content string to be set.{all}[optional]
[annotJson.coords]{Array} For a text markup annotation, quadrilaterals are required. This property has effect on text markup annotation's appearance. After setting new quadrilaterals, rectangle of current text markup annotation will be updated as well.In order to startCharIndex/endCharIndex priority.{textmarkup}(required)
[annotJson.creationTimestamp]{Timestamp} Set creation date time.{markup}[optional]
[annotJson.date]{Timestamp} Set last modified date time.{all}[optional]
[annotJson.dicts]{Object} Set annotation's dictionary object.{all}[optional]
[annotJson.defaultAppearance]{Object} Set annotation's default appearance.{freetext}[optional]
[annotJson.defaultAppearance.textColor]{Number} Set annotation's default text color (0x**RRGGBB).{freetext}[optional]
[annotJson.defaultAppearance.textSize]{Number} Set annotation's default text size.{freetext}[optional]
[annotJson.endCharIndex]{Number} For a text markup annotation, index of the end character.{textmarkup}[optional]
[annotJson.endPoint]{Object} Set the end point of line.{x: number, y: number}{line}[optional]
[annotJson.endPoint.x]{Number} The value of the X-axis in the end point.{line}[optional]
[annotJson.endPoint.y]{Number} The value of the Y-axis in the end point.{line}[optional]
[annotJson.measure]{Object} Set the measure of line.{line}[optional]
[annotJson.measure.unit]{Object} Set the label for displaying the units for measuring.{line}[optional]
[annotJson.measure.ratio]{Object} Set the scale ratio for measuring.{line}[optional]
[annotJson.measure.ratio.userSpaceValue]{Number} Set the ratio value in user space.{line}[optional]
[annotJson.measure.ratio.userSpaceUnit]{Object} Set the ratio unit in user space.{line}[optional]
[annotJson.measure.ratio.realValue]{Number} Set the ratio value in real space.{line}[optional]
[annotJson.measure.ratio.realUnit]{Object} Set the ratio unit in real space.{line}[optional]
[annotJson.endStyle]{Number} Set line ending style of the end point. Please refer to Ending_Style.{line}[optional]
[annotJson.fileName]{String} The file name to be set. This is mandatory when the multiBuffer parameter exists.{fileattachment,screen}
[annotJson.contentType]{String} Set the content type (MIME type) of the media data. This is mandatory when the multiBuffer parameter exists.{screen}
[annotJson.fillColor]{String} New fill color to be set. Format: 0xAARRGGBB, 0 for transparent, otherwise alpha will be set to 0xFF. {freetext,circle,square,polygon}[optional]
[annotJson.iconInfo]{object} Specifies the icon of stamp. Attention: this property will override "icon" and "iconCategory" properties.{stamp}[optional]
[annotJson.iconInfo.annotType]{String} The type of supported annot. Currently, it must be "stamp".{stamp}[optional]
[annotJson.iconInfo.category]{String} Category which the icon is collected.{stamp}[optional]
[annotJson.iconInfo.name]{String} The name of icon. Only ascii characters are available.{stamp}[optional]
[annotJson.iconInfo.fileType]{String} The file type of icon. One of 'bmp', 'jpg', 'jpeg', 'png'.{stamp}[optional]
[annotJson.iconInfo.url]{String} The url of icon. It supports HTTP, file, blob url and base64 url.{stamp}[optional]
[annotJson.icon]{String} Set icon name.{stamp}[optional]
[annotJson.iconCategory]{String} Set stamp icon's category.{stamp}[optional]
[annotJson.inkList]{Array} Set ink list data.If type is "ink", it should not be an empty.{ink}
[annotJson.intent]{String} Set intent name.{markup}[optional] Some example intent:
  • 'LineArrow'
  • 'LineDimension'
  • 'PolygonCloud'
  • 'PolygonDimension'
  • 'PolyLineDimension'
  • 'FreeTextTypewriter'
  • 'FreeTextCallout'
[annotJson.multiBuffer]{Uint8Array} The buffer of Media.{screen}
[annotJson.name]{String} New unique ID string to be set.{all}[optional]
[annotJson.noPopup]{Boolean} If true, no popup is generated,else popup is generated.{markup}[optional]
[annotJson.opacity]{Number} Set opacity value.only 0~1 is valid.{markup}[optional]
[annotJson.startCharIndex]{Number} For a text markup annotation,Index of the start character.{textmarkup}[optional]
[annotJson.startStyle]{Number} Set line ending style of the start point. Please refer to Ending_Style.{line}[optional]
[annotJson.startPoint]{Object} Set the start point of line.{x: number, y: number}{line}[optional]
[annotJson.startPoint.x]{Number} The value of the X-axis in the start point.{line}[optional]
[annotJson.startPoint.y]{Number} The value of the Y-axis in the start point.{line}[optional]
[annotJson.length]{Number} Set line's leader line length. {line}[optional]
[annotJson.styleFillColor]{String} Set fill color for ending styles. New fill color to be set. Format: 0xRRGGBB, 0 for transparent, otherwise alpha will be set to 0xFF.{polyline,line}[optional]
[annotJson.subject]{String} Set subject string.If the value is "replace," that means that this is a Replace annotation.{markup}[optional]
[annotJson.title]{String} Set title string.{markup}[optional]
[annotJson.vertexes]{Array} Set vertexes, Vertexes property is required for a polyline annotation. {polyline,polygon}[optional]
[annotJson.rotation]{Number} Set the rotation in clockwise, Currently, only support free text, stamp, srceen annotations. for free text, srceen annotation, this should be one of these values : 0, 90, 180, 270. for stamp annotation, the value range is from 0 to 360.
Returns
{Promise.<Array[Annot]>} - An Annot array of new added annotations.

◆ addAnnotGroup()

PDFPage::addAnnotGroup (   annotJsons,
  headerIndex 
)
inline

Add a group annotation into the current page. This method may add an annotation along with an associated annotation like popup. [Support in Server]

Parameters
annotJsons- An array of annotations json.
headerIndex- Index of header annotation.
Returns
{Promise.<Array[Annot]>}
See also
PDFPage::addAnnot

◆ addGraphicsObject()

PDFPage::addGraphicsObject (   info)
inline

Add a new graphics object to the page.

Parameters
info.type{number} - Specify the type of the new graphics object. Graphics_ObjectType .
info.buffer{ArrayBuffer} - For image object. The image file buffer, which supports png/jpg/bmp format.
info.rect{PDFRect} - For image object. Specify the rectangle on page in PDF coordination system.
info.points{[[type,x,y],...]} - For path object. The points array to construct the path.For each element of the points array, which consist of {type, x, y}:
type {string} - The path construct operator, which could be 'm','l','c','h'. ('m' stands for 'move to', 'l' stands for 'line to', 'c' stands for 'curve to', 'h' stands fo 'close figure').
x {number} - The horizontal position, in PDF page coordinate.
y {number} - The vertical position, in PDF page coordinate.
info.borderWidth{number} - For path object. Specify the width of path border, should not be negative.
info.originPosition{PDFPoint} - For text object. Specify the original position of the graphic object.
info.charspace{number} - For text object. The character space.
info.wordspace{number} - For text object. The word space.
info.textmatrix{[a,b,c,d]} - For text object. The matrix for the text inside the object.
info.textmode{number} - For text object. Text rendering mode. Please refer to values starting from Text_Mode .
info.font{fontInfo} - For text object. The font info. info.font.standardId {number} - The id of standard PDF fonts. Please refer to Font_StandardID .
info.font.name {string} - The font face name.
info.font.styles {string} - The font style. Please refer to Font_Styles .
info.font.charset {number} - The charset of the font. Please refer to Font_Charset or Font_CIDCharset .
info.font.weight {number} - The font weight.
info.matrix{Matrix} - For text object. The matrix of the text object.[optional]
Translations are specified as [1 0 0 1 tx ty], where tx and ty are the distances to translate the origin of the coordinate system in the horizontal and vertical dimensions, respectively. If this is set, the originPosition parameter is invalid.
Scaling is obtained by [sx 0 0 sy 0 0]. This scales the coordinates so that 1 unit in the horizontal and vertical dimensions of the new coordinate system is the same size as sx and sy units, respectively, in the previous coordinate system.
Rotations are produced by [cos θ sin θ −sin θ cos θ 0 0], which has the effect of rotating the coordinate system axes by an angle θ counterclockwise.
Skew is specified by [1 tan α tan β 1 0 0], which skews the x axis by an angle α and the y axis by an angle β
info.text{string} - For text object. The text content.
info.fillColor{number} - For text object. The text color, which represents as 0xFFRRGGBB.
Returns
none.
Since
7.4.0
async function example_AddTextObject() {
let info = {};
info.type = PDFViewCtrl.PDF.constant.Graphics_ObjectType.Text;
info.originPosition = {x:100, y:100};
info.charspace = 0;
info.wordspace = 20;
info.textmatrix = [1,0,0,1];
info.font = {};
info.font.standardId = e_StdIDCourier;
info.matrix = [1, 0, 0, 1, 0, 0];
info.text = "Hello World";
info.fillColor = 0xFF000000;
page.addGraphicsObject(info); //Add a new text object, display with "Hello world" at left top (0,0) position of page.
}
async function example_AddImageObject() {
let info = {};
info.type = PDFViewCtrl.PDF.constant.Graphics_ObjectType.Image;
var imageResp = await fetch(""); //Fill with your image URL string.
var imageFile = await imageResp.arrayBuffer();
info.buffer = imageFile;
info.rect = {left:100,bottom:100,right:200,top:200};
page.addGraphicsObject(info); //Add a new image object on the specified rect of the page.
}
async function example_AddPathObject() {
let info = {};
info.type = PDFViewCtrl.PDF.constant.Graphics_ObjectType.Path;
info.points = [
['m',100,100],
['l',300,300],
];
info.borderWidth = 2;
page.addGraphicsObject(info); //Add a new path object, draw a line from point {100, 100} to {300,30}, in PDF coordinate.
}

◆ addImage()

PDFPage::addImage (   imageBuffer,
  rect,
  rotation = 0 
)
inline

Add the image to page.

Parameters
imageBuffer{Uint8Buffer} - Image ArrayBuffer.
rect{PDFRect} - Image Rect. {left:number,right:number, top: number, bottom: number}
rotation{number} - Image rotation. It should be 0,90,180 or 270;
Returns
{Promise.<ImageObjec||null>} - Image object if success.

◆ addWatermark()

PDFPage::addWatermark (   data)
inline

Add a page watermark.

Parameters
watermarkConfig{Object} - Page watermarking configuration. Example:
{
type:"text",
text:"This is a watermark",
watermarkSettings:{
position:"TopLeft",
offsetX:0,
offsetY:0,
scale:1,
rotation:45,
opacity:100
},
watermarkTextProperties:{
font:2,
fontSize:20,
color:0x000000,
fontStyle:"normal"
}
};
watermarkConfig.type{string} -
1."text" represents a text type watermark.
2."bitmap" represents the image type watermark.
watermarkConfig.text{string} - Text type watermark string.If type is "text".
watermarkConfig.bitmap{Uint8Array} - Image type watermark buffer.If type is "bitmap".
watermarkConfig.useRelativeScale{boolean} - Whether the scale relative to target page or not, If ture, The parameter "watermarkConfig.watermarkSettings.scale" is work, or the parameter "watermarkConfig.watermarkTextProperties.fontSize" is work. The default value is true.
watermarkConfig.watermarkSettings{Object} - watermark -related configuration.
watermarkConfig.watermarkSettings.position{string} - Please Refer to Position. Default: Position.Center.
watermarkConfig.watermarkSettings.offsetX{number} - Horizontal offset. in points. The default value is 0.
watermarkConfig.watermarkSettings.offsetY{number} - Vertical offset. in points. The default value is 0.
watermarkConfig.watermarkSettings.flags{number} - Watermark flags. Please refer to Watermark_Flag. The default value is Watermark_Flag.onTop.
watermarkConfig.watermarkSettings.scale{number} - scale coefficient.The default value is 1. It should be greater than 0.01f, Valid range: from 0.01 to 1.
watermarkConfig.watermarkSettings.rotation{number} - Rotation angle in degrees.The default value is 45.
watermarkConfig.watermarkSettings.opacity{number} - Opacity in percents. Valid range: from 0 to 100. 0 for fully transparent and 100 for fully opaque.The default value is 100.
watermarkConfig.watermarkTextProperties{Object} - Configuration for text watermarking.
watermarkConfig.watermarkTextProperties.font{number} - Specify Font object used for the text.Please refer to Standard_Font.Default: Standard_Font.courier.
watermarkConfig.watermarkTextProperties.fontSize{number} - font size.The default value is 20.
watermarkConfig.watermarkTextProperties.color{number} - <Hexadecimal> font color.The default value is "0x000000".
watermarkConfig.watermarkTextProperties.fontStyle{string} - The default value is "normal".
1."normal":Watermark font style: normal.
2."underline":Watermark font style: with underline.

◆ flatten()

PDFPage::flatten (   option)
inline

Flatten all annotations and interactive form fields in a Page.

Parameters
option{int} - Specify which objects will be flattened. Please Refer to Flatten_Option
Returns
{Promise.<boolean>} - success flag.

◆ getAnnotCount()

PDFPage::getAnnotCount ( )
inline

Gets the total amount of all annotations in a specified page. [Support in Server]

Returns
{number} - the total numebr of page annotations

◆ getAnnotIdAtDevicePoint()

PDFPage::getAnnotIdAtDevicePoint (   point,
  tolerance,
  matrix 
)
inline

Get the specified position of an annotation in device page coordinate. [Support in Server]

Parameters
[x,y]{[number, number]} - The specified position, in device coordinate system.
tolerance{number} - The tolerance value. Valid range: 0.0f to 30.0f.
matrix{Matrix} - The device matrix such as page.getDeviceMatrix();
Returns
{Promise<string>} - Annotation's ID
function example (scale) {
var matrix = page.getDeviceMatrix();
matrix.scale(scale, scale);
return page.getAnnotIdAtDevicePoint([x, y], tolerance, [matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f]);
}

◆ getAnnotObjectNumAtDevicePoint()

PDFPage::getAnnotObjectNumAtDevicePoint (   point,
  tolerance,
  matrix 
)
inline

Get the specified position of an annotation in device page coordinate. [Support in Server]

Parameters
[x,y]{[number, number]} - The specified position, in device coordinate system.
tolerance{number} - The tolerance value. Valid range: 0.0f to 30.0f.
matrix{Matrix} - The device matrix such as page.getDeviceMatrix();
Returns
{Promise<int>} - Annotation's ID
function example (scale) {
var matrix = page.getDeviceMatrix();
matrix.scale(scale, scale);
return page.getAnnotObjectNumAtDevicePoint([x, y], tolerance, [matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f]);
}
Since
8.1.0

◆ getAnnots()

PDFPage::getAnnots (   reload = false)
inline

Get an array of all annotations in a page. [Support in Server]

Returns
{Promise.<Annot[]>} - Annotation objects of page annotations.

◆ getAnnotsByIdArray()

PDFPage::getAnnotsByIdArray (   ids)
inline

Get an array of page annotation ID which can be obtained by Annot::getUniqueID(). [Support in Server]

Parameters
ids{Array[string]} - Specifies annotations ID.
Returns
{Promise.<Annot[]>} - Annot objects of page annotations.

◆ getAnnotsByObjectNumArray()

PDFPage::getAnnotsByObjectNumArray (   objNums)
inline

Get an array of page annotation object number which can be obtained by Annot::getObjectNumber(). [Support in Server]

Parameters
objNums{Array[number]} - Specifies annotations ID.
Returns
{Promise.<Annot[]>} - Annot objects of page annotations.
Since
8.1.0

◆ getAnnotTree()

PDFPage::getAnnotTree ( )
inline

Get a structrual tree of all annotations in a specified page. [Support in Server]

Returns
Promise<Annot[]> - annotations in this page excluding popups, replies and state annotations.

◆ getCharInfoAtPoint()

PDFPage::getCharInfoAtPoint (   point,
  tolerance = 0 
)
inline

Get character information at a specified position, in PDF coordination system.

Parameters
[x,y]{[number, number]} - The specified position, in PDF coordinate system.
tolerance{number} - Tolerance value. Valid range: 0.0f to 30.0f.
Returns
{Promise.<object>} - {charIndex:number, left:number, right:number, top:number, bottom:number}

◆ getDeviceMatrix()

PDFPage::getDeviceMatrix (   rotate = 0)
inline

Get the device matrix for the page. [Support in Server]

Parameters
[rotate=0]{number} - Rotation Angle. Only support multiples of 90. The other values default to 0.
Returns
{Matrix} - Page's device displaying matrix.

◆ getDevicePoint()

PDFPage::getDevicePoint (   point,
  scale = 1,
  rotate = 0 
)
inline

Convert PDF coordinates to device coordinates for the page. [Support in Server]

Parameters
point{number[]]} - Specifies PDF page point coordinate.
[scale=1]{number} - Indecate magnification
[rotate=0]{number} - Rotation Angle. Only support multiples of 90. The other values default to 0.
Returns
[x,y] {[number,number]} - Device point coordinate.

◆ getDeviceRect()

PDFPage::getDeviceRect (   pdfRect,
  scale = 1,
  rotate = 0 
)
inline

Convert PDFRect to deviceRect [Support in Server]

Parameters
pdfRect{PDFRect} - PDF Rect. {left:number,right:number, top: number, bottom: number}
[scale=1]{number} - Rect magnification
[rotate=0]{number} - Rotation Angle. Only support multiples of 90. The other values default to 0.
Returns
{DeviceRect} - Device Rect. {left:number,right:number, top: number, bottom: number}

◆ getDict()

PDFPage::getDict ( )
inline

Get the dictionary of the pdf page.

Since
7.6.0
Returns
{Promise.<PDFDictionary>} - The pdf page dictionary.
Example:
async function example (pdfPage) {
let pageDict= await pdfPage.getDict();
return pageDict;
}

◆ getGraphicsObjectAtPoint()

PDFPage::getGraphicsObjectAtPoint (   point,
  tolerance,
  type 
)
inline

Get graphics object at the specified point on the page.

Parameters
point{[number number]} - The point on the pdf page, in PDF coordinate.
tolerance{number} - The inaccuracy to be tolerable for the point.
type{number} - The type of graphic object. Graphics_ObjectType .
Returns
{Promise<GraphicsObject>} - Page graphics object.
Since
7.4.0
const point = [100, 100];
const pageObj = page.getGraphicsObjectAtPoint(point, 0, PDFViewCtrl.PDF.constant.Graphics_ObjectType.All); //Get the object at the point, no matter what type.

◆ getGraphicsObjectByIndex()

PDFPage::getGraphicsObjectByIndex (   index)
inline

Get page graphics object by Index.

Parameters
index{number} - Index of page graphics object.
Returns
{Promise<GraphicsObject>} - Page graphics object.
Since
7.3.0

◆ getGraphicsObjectsCount()

PDFPage::getGraphicsObjectsCount ( )
inline

Get the count of the graphics objects on the page.

Returns
{Promise<number>} - The count of the graphics objects.
Since
7.4.0

◆ getGraphicsObjectsInRect()

PDFPage::getGraphicsObjectsInRect (   rect,
  tolerance,
  type 
)
inline

Get graphics objects of the specified rectangle on the page.

Parameters
rect{PDFRect} - Specifies page rectangle in PDF coordination system.
tolerance{number} - The inaccuracy to be tolerable for the rectangle.
type{number} - The type of graphic object. Graphics_ObjectType .
Returns
{Promise<GraphicsObject[]>} - Page graphics objects array.
Note
e_TypeShading and e_TypeFormXObject is not supported.
Since
7.4.0
const rect = {left:0, bottom:0, right:100, top:100};
const pageObjs = page.getGraphicsObjectsInRect(rect, 0, PDFViewCtrl.PDF.constant.Graphics_ObjectType.All); //Get the objects in the rect, no matter what type.
for(let obj in pageObjs) { //Now page objects are ready.
};

◆ getHeight()

PDFPage::getHeight ( )
inline

Get page height. [Support in Server]

Returns
{number} - Page's height with point unit.

◆ getIndex()

PDFPage::getIndex ( )
inline

Get page's index.

Returns
{number} - Page index.

◆ getMarkupAnnots()

PDFPage::getMarkupAnnots ( )
inline

Get only markup annotations in the current page. [Support in Server]

Returns
Promise<Markup[]> - All markup annotations excluding popup, replies and states in this page.

◆ getPageBox()

PDFPage::getPageBox (   boxType)
inline

Get page box rectangle (in PDF coordinate system).

Since
7.4.0
Parameters
boxTypenumber - Box type. Please refer to Box_Type.
Returns
Promise<PDFRect> - PDF page box rectangle

◆ getPDFDoc()

PDFPage::getPDFDoc ( )
inline

Get the document object [Support in Server]

Returns
{PDFDoc} - Document object which own this page.

◆ getPDFMatrix()

PDFPage::getPDFMatrix ( )
inline

Get page matrix [Support in Server]

Returns
{Matrix} - Page's displaying matrix.

◆ getRotation()

PDFPage::getRotation ( )
inline

Get page rotation angle.

Returns
{number} - Get page rotation. Please refer to Rotation.

◆ getRotationAngle()

PDFPage::getRotationAngle ( )
inline

Get page rotation angle. [Support in Server]

Returns
{number} - Get page rotation degree. Please refer to Rotation_Degree.

◆ getSnappedPoint()

PDFPage::getSnappedPoint (   point,
  mode 
)
inline

Get the snap point based on the given point and snap mode which should be passed as array.

Parameters
pointobject Point on the page in PDF Point unit
point.xnumber The X-axis coordinate with the origin at left-bottom corner of the PDF page
point.ynumber The Y-axis coordinate with the origin at left-bottom corner of the PDF page
modethe value be passed as array, it refers to PDFViewCtrl.constants.SNAP_MODE.
See also
reverseDevicePoint
Returns
Promise.<{x,y, type}> Return the point value and the type of the snapped point, and the type refers to PDFViewCtrl.constants.SNAP_MODE. If there is no snapped point, it will return the orign point and the type is undefined.
Since
7.6.0

◆ getTextRectsAtRect()

PDFPage::getTextRectsAtRect (   rect)
inline

Get page text rectangles in specified rectangle. [Support in Server]

Parameters
rect{PDFRect} - Specifies page rectangle in PDF coordination system.
Returns
{Promise.<PDFRect[]>} - The text rectangles in PDF coordination system.

◆ getTextSearch()

PDFPage::getTextSearch (   pattern,
  flags 
)
inline

Get PageTextSearch with specified pattern and flags. [Support in Server]

Parameters
pattern{String}
flags{number} - Specify search flag. Please refer to Search_Flag.
Returns
{Promise.<PageTextSearch>|*} - PageTextSearch

◆ getThumb()

PDFPage::getThumb (   rotate = 0,
  ratio = 1 
)
inline

Get the PDF stream of "Thumb". [Support in Server]

Parameters
rotatenumber - rotation degrees of thumbnail image, it should be 0,90,180 or 270
Returns
{Promise.<Object>} - {buffer: Uint8Array , width: int, height: int}

◆ getWidth()

PDFPage::getWidth ( )
inline

Get page width. [Support in Server]

Returns
{number} - Page width with point unit.

◆ isCropped()

PDFPage::isCropped ( )
inline

Use CropBox to determine whether the page is cropped.

Since
7.4.0
Returns
{boolean}

◆ isScannedPage()

PDFPage::isScannedPage ( )
inline

判断是否scanned文档

◆ isVirtual()

PDFPage::isVirtual ( )
inline

Some PDF pages are generated without necessary dictionary entries, and can’t be rendered and processed properly in a standard PDF reader. These non-standard pages are marked as virtual pages in our Web SDK. To render this type of pages correctly without causing any errors, you should call this API to detect virtual pages when these pages are in focus and disable actions such as widget creation, PPO, Action, Redaction, and so on.

Since
8.1.0
Returns
boolean

◆ markRedactAnnot()

PDFPage::markRedactAnnot (   rects)
inline

Mark page contents (text object, image object, and path object) which are to be redacted.

Parameters
rects- Specify areas in the page to be marked. It should not be an empty array. All the input rectangles will be treated as one redact annotation.
Returns
{Promise.<Array[Annot]>} - An Annot array of new added annotations.

◆ removeAllAnnot()

PDFPage::removeAllAnnot ( )
inline

Remove all annotations from the current page. [Support in Server]

Returns
{Promise.<Array[Annot]>}

◆ removeAnnotById()

PDFPage::removeAnnotById (   id)
inline

Remove an annotation by ID from the current page. The ID can be obtained by Annot::getUniqueID(). [Support in Server]

Parameters
id{string} - An ID string of the annotation which will be removed.
Returns
{Promise.<Array[Annot]>}

◆ removeAnnotByObjectNumber()

PDFPage::removeAnnotByObjectNumber (   objNum)
inline

Remove an annotation by object number from the current page. The object number can be obtained by Annot::getObjectNumber(). [Support in Server]

Parameters
objNum{nuumber} - An number of the specifeid annotation which will be removed.
Returns
{Promise.<Array[Annot]>}
Since
8.1.0

◆ removeGraphicsObject()

PDFPage::removeGraphicsObject (   obj)
inline

Remove the specified graphic object.

Parameters
obj{page object} - Specify the page object to be removed.
Returns
none.
Since
7.4.0

◆ render()

PDFPage::render (   scale,
  rotate,
  area,
  contentsFlags = ['page'],
  usage = 'view' 
)
inline

Get page bitmap. [Support in Server]

Since
7.2.0
Parameters
[scale=1]{number} - Rect magnification.
[rotate]{number} - Rotation Angle. Only support multiples of 90. Please refer to Rotation_Degree.
[area]{object} - Display area in user space(scaled). {x: number, y: number, width: number, height: number}
[area.x]{number} - The value of the X-axis in the upper left corner of the device coordinate system
[area.y]{number} - The value of the Y-axis in the upper left corner of the device coordinate system
[area.width]{number} - Displays the width of the bitmap
[area.height]{number} - Displays the height of the bitmap
[contentsFlags=['page']]{string[]} - Enumeration for rendering content flags. Please refer to Rendering_Content. Default: [Rendering_Content::page].
[usage='view']{string} - Enumeration for rendering content flags. Please refer to Rendering_Usage. Default: Rendering_Usage::view.
Returns
{Promise.<object>} - {width: number, height: number, buffer: ArrayBuffer, image: Blob<image/png>} - A object with bitmap buffer.If an image has a value, use image first. image is streams in PNG format.

◆ reverseDeviceOffset()

PDFPage::reverseDeviceOffset (   offset,
  scale = 1,
  rotate = 0 
)
inline

Convert PDF device page offset to PDF page offset. [Support in Server]

Parameters
offset{number[]} - Device offset.
[scale=1]{number} - Indecates magnification.
[rotate=0]{number} - Rotation Angle. Only support multiples of 90. The other values default to 0.
Returns
{number[]} - PDF page offset.

◆ reverseDevicePoint()

PDFPage::reverseDevicePoint (   point,
  scale = 1,
  rotate = 0 
)
inline

Transform PDF page point device coordinate to PDF page coordinate. [Support in Server]

Parameters
point{number[]} - Specifies device point coordinate
[scale=1]{number} - Indecates magnification.
[rotate=0]{number} - Rotation Angle. Only support multiples of 90. The other values default to 0.
Returns
{number[]} - PDF page point coordinate.

◆ reverseDeviceRect()

PDFPage::reverseDeviceRect (   pdfRect,
  scale = 1,
  rotate = 0 
)
inline

Transform PDF page device rectangle to PDF page rectangle. [Support in Server]

Parameters
pdfRect{DeviceRect} - Indicates PDF page device rectangle
[scale=1]{number} - Indicates magnification.
Returns
{PDFRect} - PDF page rectangle

◆ setRotation()

PDFPage::setRotation (   rotation)
inline

Set page rotation. [Support in Server]

Parameters
rotation{number} - Rotation to be set. Please refer to Rotation.
Example:
function example (pdfPage, pdfViewer, engineEvent) {
pdfPage.setRotation(1).then(function () {
// rotation change success
});
pdfViewer.getEventEmitter().on(engineEvent.pageRotationChange, function (pdfPage, newRotation, oldRotation) {
// rotation change success
)
}

Foxit Software Corporation Logo
@2022 Foxit Software Incorporated. All rights reserved.