| FoxitPDFSDKforWeb v11.0.5 Archives Foxit PDF SDK for Web

Public Member Functions | List of all members
PDFPage Class Reference
PDF

## 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...
| changeAnnotOrder (orderType, annot)
| Change the annotation's order. Not support Popup and Watemark. More...
| flatten (option)
| Flatten current PDF page: annotations or form fields may be made to be a part of the page contents according to specified options. More...
| flattenAnnot (annot)
| Flatten an annotation: the annotation is made to be a part of the page contents and be removed. More...
| getAdditionalAction ()
| Retrives the additional action object. More...
| getAllBoxes ()
| Gets all boxes. 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, triggerEvent=true)
| 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, force=false)
| 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...
| getBatchProcessor ()
| Obtains the BatchProcessor instance. Batch processors can be used to improve property update performance. 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...
async | getGraphicsObjectsByRect (options)
| Gets the graphics object that intersects or contains the specified bounding rectangle. 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...
| getMeasureScaleRatio ()
| Get the scale ratio for measuring. 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...
| getSuggestedFormDesignerRect (point)
| getTextContinuousRectsAtPoints (point1, point2, tolerance=8, start, end)
| Gets the rectangle of the consecutively selected text. More...
| getTextInRect (rect, type=0)
| Get the text within a rectangle, in PDF coordinate system. 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...
| getViewportRect ()
| Get the view port rectangle. More...
| getWidth ()
| Get page width. [Support in Server] More...
| getWordCount ()
| Get the page's word count. More...
| isCropped ()
| Use CropBox to determine whether the page is cropped. More...
| 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...
| pasteAnnot (srcAnnot, position)
| Paste annotation at the specified position. 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...
| setMeasureScaleRatio (storeInPage, unitName, ratio, scale)
| Set the scale ratio for measuring. More...
| setPageSize (width, height)
| Set the page size and triggers the DataEvents.pagesBoxChanged event after completion. More...
| setRotation (rotation)
| splitTextInRect (rect, limit)
| Split the text in the specified rectangle. More...

## 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 | Annot_Type - The type of annotation to be added. Support type: Annot_Type::highlight Annot_Type::strikeOut Annot_Type::underline Annot_Type::squiggly Annot_Type::caret Annot_Type::text Annot_Type::fileAttachment Annot_Type::freeText Annot_Type::ink Annot_Type::line Annot_Type::link Annot_Type::circle Annot_Type::square Annot_Type::polygon Annot_Type::polyline Annot_Type::stamp Annot_Type::screen
  annotJson.rect | object - Rectangle of the new annotation.
  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. [optional]
  [annotJson.borderInfo.width] | number - Border width. [optional]
  [annotJson.borderInfo.style] | number - Border style.Style {0:"Solid", 1:"Dashed", 2:"UnderLine", 3:"Beveled",4:"Inset", 5:"Cloudy"}. [optional] If the boder style is set to the unsupporetd type annotation, It will change to set border style as 'Solid' by default internally. For details: 0 ("Solid"): Solid border. 1 ("Dashed"): This is only useful for link, free text, line, square, circle, polygon, polyline and screen annotation. 2 ("UnderLine"): This is only useful for link annotation. 3 ("Beveled"): Currently, It does not support the annotation appearance of this border style. 4 ("Inset"): Currently, It does not support the annotation appearance of this border style. 5 ("Cloudy"): This is only useful for free text, square, circle, and polygon annotations.
  [annotJson.borderInfo.cloudIntensity] | number - Intensity of the cloudy effect.Only useful when parameter style is "Cloudy". [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". [optional]
  [annotJson.borderInfo.dashes] | number[] - A dash array that represents the dash patterns.Only useful when parameter style is "Dashed". [optional]
  [annotJson.alignment] | number - Set alignment value. Alignment { 0:"AlignmentLeft", 1:"AlignmentCenter", 2:"AlignmentRight" } [optional] This parameter is valid only when the type is freetext.
  [annotJson.buffer] | Uint8Array - The buffer of file. This parameter is valid only when the type is fileattachment and screen.
  [annotJson.calloutLinePoints] | 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. [optional] This parameter is valid only when the type is freetext.
  [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. 0 for transparent.[optional]
  [annotJson.contents] | string - New content string to be set. [optional] If annotJson.richText is set and annotJson.type equal to freetext, this parameter is invalid.
  [annotJson.coords] | Array<{left:number;top:number;right:number;bottom:number;}> - 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. This parameter is valid only when the type is textmarkup. (required)
  [annotJson.creationTimestamp] | number - Set creation date time. [optional] This parameter is valid only when the type is markup.
  [annotJson.date] | number - Set last modified date time. [optional]
  [annotJson.dicts] | object - Set annotation's dictionary object. [optional]
  [annotJson.defaultAppearance] | object - Set annotation's default appearance. [optional] If annotJson.richText is set and annotJson.type equal to freetext, this parameter is invalid. This parameter is valid only when the type is freetext.
  [annotJson.defaultAppearance.textColor] | number - Set annotation's default text color (0x**RRGGBB). [optional] This parameter is valid only when the type is freetext.
  [annotJson.defaultAppearance.textSize] | number - Set annotation's default text size. [optional] This parameter is valid only when the type is freetext.
  [annotJson.endCharIndex] | number - For a text markup annotation, index of the end character. [optional] This parameter is valid only when the type is textmarkup. Setting both annotJson.startCharIndex and annotJson.endCharIndex will calculate the value of annotJson.coords internally and replace it.
  [annotJson.endPoint] | object - Set the end point of line.{x: number, y: number} [optional] This parameter is valid only when the type is line.
  [annotJson.endPoint.x] | number - The value of the X-axis in the end point. [optional] This parameter is valid only when the type is line.
  [annotJson.endPoint.y] | number - The value of the Y-axis in the end point. [optional] This parameter is valid only when the type is line.
  [annotJson.flags] | number - The annotation flags. Please refer to values starting from Annot_Flags.invisible and this would be one or a combination of these values. The default value is 0. It will also not print.
  [annotJson.measure] | object - Set the measure of line. [optional] This parameter is valid only when the type is circle, line, polyline, polygon and square.
  [annotJson.measure.unit] | string - Set the label for displaying the units for measuring. [optional] This parameter is valid only when the type is circle, line, polyline, polygon and square.
  [annotJson.measure.ratio] | object - Set the scale ratio for measuring. [optional] This parameter is valid only when the type is circle, line, polyline, polygon and square.
  [annotJson.measure.ratio.userSpaceValue] | number - Set the ratio value in user space. [optional] This parameter is valid only when the type is circle, line, polyline, polygon and square.
  [annotJson.measure.ratio.userSpaceUnit] | string - Set the ratio unit in user space. [optional] This parameter is valid only when the type is circle, line, polyline, polygon and square.
  [annotJson.measure.ratio.realValue] | number - Set the ratio value in real space. [optional] This parameter is valid only when the type is circle, line, polyline, polygon and square.
  [annotJson.measure.ratio.realUnit] | string - Set the ratio unit in real space. [optional] This parameter is valid only when the type is circle, line, polyline, polygon and square.
  [annotJson.endStyle] | Ending_Style - Set line ending style of the end point. Please refer to Ending_Style. [optional] This parameter is valid only when the type is line.
  [annotJson.fileName] | string - The file name to be set. This is mandatory when the multiBuffer parameter exists. This parameter is valid only when the type is fileattachment and screen.
  [annotJson.contentType] | string - Set the content type (MIME type) of the media data. This is mandatory when the multiBuffer parameter exists. This parameter is valid only when the type is screen.
  [annotJson.fillColor] | string - New fill color to be set. Format: 0xRRGGBB. 0 for transparent. [optional] This parameter is valid only when the type is freetext, circle, square and polygon.
  [annotJson.iconInfo] | object - Specifies the icon of stamp. Attention: this property will override "icon" and "iconCategory" properties. [optional] This parameter is valid only when the type is stamp.
  [annotJson.iconInfo.annotType] | string - The type of supported annot. Currently, it must be "stamp". [optional] This parameter is valid only when the type is stamp.
  [annotJson.iconInfo.category] | string - Category which the icon is collected. [optional] This parameter is valid only when the type is stamp.
  [annotJson.iconInfo.name] | string - The name of icon. Only ascii characters are available. [optional] This parameter is valid only when the type is stamp.
  [annotJson.iconInfo.fileType] | string - The file type of icon. One of 'bmp', 'jpg', 'jpeg', 'png', 'webp', 'pdf'. [optional] This parameter is valid only when the type is stamp.
  [annotJson.iconInfo.url] | string - The url of icon. It supports HTTP, file, blob url and base64 url. [optional] This parameter is valid only when the type is stamp.
  [annotJson.icon] | string - Set icon name. The name of icon. Only ascii characters are available. [optional] This parameter is valid only when the type is stamp.
  [annotJson.iconCategory] | string - Set stamp icon's category. [optional] This parameter is valid only when the type is stamp.
  [annotJson.inkList] | Array<{x:number;y:number;type:1|2|3;}> - Set ink list data.If type is "ink", it should not be an empty. This parameter is valid only when the type is ink.
  [annotJson.intent] | string - Set intent name. [optional]. Please refer to IMarkupAnnotationSummary::intent This parameter is valid only when the type is markup.
  [annotJson.multiBuffer] | Uint8Array - The buffer of Media. This parameter is valid only when the type is screen.
  [annotJson.name] | string - New unique ID string to be set. [optional]
  [annotJson.noPopup] | boolean - If true, no popup is generated,else popup is generated. [optional] This parameter is valid only when the type is markup.
  [annotJson.opacity] | number - Set opacity value.only 0~1 is valid. [optional] This parameter is valid only when the type is markup.
  [annotJson.startCharIndex] | number - For a text markup annotation,Index of the start character. [optional] This parameter is valid only when the type is textmarkup. Setting both annotJson.startCharIndex and annotJson.endCharIndex will calculate the value of annotJson.coords internally and replace it.
  [annotJson.startStyle] | number - Set line ending style of the start point. Please refer to Ending_Style. [optional] This parameter is valid only when the type is line.
  [annotJson.startPoint] | object - Set the start point of line.{x: number, y: number} [optional] This parameter is valid only when the type is line.
  [annotJson.startPoint.x] | number - The value of the X-axis in the start point. [optional] This parameter is valid only when the type is line.
  [annotJson.startPoint.y] | number - The value of the Y-axis in the start point. [optional] This parameter is valid only when the type is line.
  [annotJson.length] | number - Set line's leader line length. [optional] This parameter is valid only when the type is line.
  [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. [optional] This parameter is valid only when the type is polyline,line.
  [annotJson.subject] | string - Set subject string.If the value is "replace," that means that this is a Replace annotation. [optional] This parameter is valid only when the type is markup.
  [annotJson.title] | string - Set title string. [optional] This parameter is valid only when the type is markup.
  [annotJson.vertexes] | Array<{x:number;y:number;}> - Set vertexes, Vertexes property is required for a polyline annotation. [optional] This parameter is valid only when the type is polyline and polygon.
  [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.
  [annotJson.richText] | object[] - An array of rich text data. Now, Only support FreeText annotation.
  [annotJson.richText[].content] | string - Text string to be set as content for specified rich text. This should not be an empty string.
  [annotJson.richText[].richTextStyle] | object - The style data of a rich text string
  [annotJson.richText[].richTextStyle.font] | object - A valid font object.
  [annotJson.richText[].richTextStyle.font.name] | string - the face name of the font. If it`s a standard font, the font styles and charset will not work. The standard font are 'Courier','Courier-Bold','Courier-BoldOblique','Courier-Oblique', 'Helvetica','Helvetica-Bold','Helvetica-BoldOblique','Helvetica-Oblique','Times-Roman', 'Times-Bold','Times-BoldItalic','Times-Italic','Symbol','ZapfDingbats'. While using 'Symbol' or 'ZapfDingbats, the parameter "richTextStyle.isBold" and "richTextStyle.isItalic" will not work. If it`s a custom font, you should call PDFViewer.setJRFontMap to map the available fonts.
  [annotJson.richText[].richTextStyle.font.styles] | number - The font styles. Please refer to Font_Styles .
  [annotJson.richText[].richTextStyle.font.charset] | number - The charset of the font. Please refer to Font_Charset or Font_CIDCharset .
  [annotJson.richText[].richTextStyle.textSize] | number - Text size. It should not be negative value. 0 means text will not be shown.
  [annotJson.richText[].richTextStyle.textAlignment] | number - Alignment value. Please Refer to Alignment .
  [annotJson.richText[].richTextStyle.textColor] | number - Text color. Format: 0xRRGGBB.
  [annotJson.richText[].richTextStyle.isBold] | boolean - A boolean value which indicates whether to make text bold or not.
  [annotJson.richText[].richTextStyle.isItalic] | boolean - A boolean value which indicates whether to italicize text or not.
  [annotJson.richText[].richTextStyle.isUnderline] | boolean - A boolean value which indicates whether to underline text or not.
  [annotJson.richText[].richTextStyle.isStrikethrough] | boolean - A boolean value which indicates whether to cross text out with strike through or not.
  [annotJson.richText[].richTextStyle.cornerMarkStyle] | number - Corner mark style which can be used to make text as superscript or subscript or not as any kind of corner mark. 1 - Corner mark style: none. 2 - Corner mark style: superscript. 3 - Corner mark style: subscript.

Returns
  Promise<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 | Array<object> - An array of annotations json.
  headerIndex | number - Index of header annotation.

Returns
  Promise<Annot[]> -

See also
  PDFPage::addAnnot

## ◆ addGraphicsObject()

PDFPage::addGraphicsObject | ( |  | info | ) |
| inline

Add a new graphics object to the page.

Parameters

  info.type | Graphics_ObjectType - 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] | Array<[string, number, number]> - 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] | [number,number,number,number] - 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] | object - For text object. The font info.
  [info.font.standardId] | Font_StandardID - The id of standard PDF fonts. Please refer to Font_StandardID .
  [info.font.name] | string - The font face name.
  [info.font.styles] | Font_Styles - The font style. Please refer to Font_Styles .
  [info.font.charset] | Font_Charset|Font_CIDCharset - The charset of the font. Please refer to Font_Charset or Font_CIDCharset .
  [info.font.weight] | number - The font weight.
  [info.matrix] | [number,number,number,number,number,number] - 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
  Promise<void> -

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 | ArrayBuffer - Image ArrayBuffer.
  rect | PDFRect - Image Rect. {left:number,right:number, top: number, bottom: number}
  [rotation=0] | number - Image rotation. It should be 0,90,180 or 270;

Returns
  Promise<ImageObject|undefined|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 | 'text'|'bitmap' - The type of watermark. 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=true] | boolean - Determine if the scale is relative to the target page. If it is true, use the "watermarkConfig.watermarkSettings.scale", otherwise, use the "watermarkConfig.watermarkTextProperties.fontSize". The default value is true.
  watermarkConfig.watermarkSettings | object - Watermark-related configuration.
  [watermarkConfig.watermarkSettings.position=Position.center] | Position - Please Refer to Position. Default: Position.center.
  [watermarkConfig.watermarkSettings.offsetX=0] | number - Horizontal offset. In points. The default value is 0.
  [watermarkConfig.watermarkSettings.offsetY=0] | number - Vertical offset. In points. The default value is 0.
  watermarkConfig.watermarkSettings.flags | Watermark_Flag - Watermark flags. Please refer to Watermark_Flag.
  [watermarkConfig.watermarkSettings.scale=1] | 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=45] | number - Rotation angle in degrees. The default value is 45.
  [watermarkConfig.watermarkSettings.opacity=100] | 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=Standard_Font.courier] | Standard_Font - Specify Font object used for the text. Please refer to Standard_Font.Default: Standard_Font.courier.
  [watermarkConfig.watermarkTextProperties.fontSize=20] | number - Font size. The default value is 20.
  [watermarkConfig.watermarkTextProperties.color=0x000000] | number - Font color<Hexadecimal>. The default value is "0x000000".
  [watermarkConfig.watermarkTextProperties.fontStyle='normal'] | 'normal'|'underline' - The default value is "normal". 1."normal":Watermark font style: normal. 2."underline":Watermark font style: with underline.

## ◆ changeAnnotOrder()

PDFPage::changeAnnotOrder | ( |  | orderType,
|  |  | annot
| ) |  |
| inline

Change the annotation's order. Not support Popup and Watemark.

Note
  Highlight, Redact, Link and Screen is unchanged on the UI.

Parameters

  orderType | number - The type of the annotation's order. Please refer to values starting from PosType
  annot | Annot - The specified annotation's order will be changed.

Returns
  Promise<void> -

Example:
  async function example (pdfPage) {
  let annots = await pdfPage.getAnnots();
  await pdfPage.changeAnnotOrder(PDFViewCtrl.PDF.constant.PosType.last,annots[0]);
  }

Since
  10.0.0

## ◆ flatten()

PDFPage::flatten | ( |  | option | ) |
| inline

Flatten current PDF page: annotations or form fields may be made to be a part of the page contents according to specified options.

Parameters

  option | number - Specify which objects will be flattened. Please Refer to Flatten_Option

Returns
  Promise<boolean> - success flag.

## ◆ flattenAnnot()

PDFPage::flattenAnnot | ( |  | annot | ) |
| inline

Flatten an annotation: the annotation is made to be a part of the page contents and be removed.

Parameters

  annot | Annot - An annotation to be flattened and removed.

Returns
  Promise<boolean> - true means success, while false means failure.

Since
  11.0.0

## ◆ getAdditionalAction()

PDFPage::getAdditionalAction | ( |  | ) |
| inline

Retrives the additional action object.

Returns
  AdditionalAction<PageActionTriggerEvents> - The additional action object used to manipulate additional actions.

Since
  11.0.0

## ◆ getAllBoxes()

PDFPage::getAllBoxes | ( |  | ) |
| inline

Gets all boxes.

Returns

       Promise<{
          mediaBox: PDFRect, // Media Box for page boundary
          cropBox: PDFRect, // Crop Box for page boundary
          trimBox: PDFRect, // Trim Box for page boundary
          artBox: PDFRect, // Art Box for page boundary
          bleedBox: PDFRect, // Bleed Box for page boundary
          calcBox: PDFRect, // Content area of PDF page, refer to
          minWidth: number, // Min width of all boxes
          minHeight: number, // Min height of all boxes
      }>

Since
  8.4.0

## ◆ 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

  point | [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

  point | [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<number> - 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`,
|  |  | triggerEvent = `true`
| ) |  |
| 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 | string[] - Specifies annotations ID.

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

## ◆ getAnnotsByObjectNumArray()

PDFPage::getAnnotsByObjectNumArray | ( |  | objNums,
|  |  | force = `false`
| ) |  |
| inline

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

Parameters

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

## ◆ getBatchProcessor()

PDFPage::getBatchProcessor | ( |  | ) |
| inline

Obtains the BatchProcessor instance. Batch processors can be used to improve property update performance.

Returns
  PDFPageBatchProcessor -

Since
  9.0.0

## ◆ getCharInfoAtPoint()

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

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

Parameters

  point | [number, number] - The specified position, in PDF coordinate system.
  tolerance | number - Tolerance value. Valid range: 0.0f to 30.0f.

Returns
  Promise<{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, number] - Specifies PDF page point coordinate: [x, y].
  [scale=1] | number - Indecate magnification
  [rotate=0] | number - Rotation Angle. Only support multiples of 90. The other values default to 0.

Returns
  [number,number] - Device point coordinate: [x, y].

## ◆ 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 | Graphics_ObjectType - 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

## ◆ getGraphicsObjectsByRect()

async PDFPage::getGraphicsObjectsByRect | ( |  | options | ) |
| inline

Gets the graphics object that intersects or contains the specified bounding rectangle.

Parameters

  options | object
  options.rect | PDFRect - Specifies page rectangle in PDF coordination system.
  options.tolerance | number - The inaccuracy to be tolerable for the rectangle.
  options.type | Graphics_ObjectType - The graphics object type except Graphics_ObjectType.FormXObject.
  [options.isInRect=true] | boolean - If true, all graphics object within the bounds of the rectangle will be returned, if false, all graphics objects that intersect the rectangle will be returned.

Since
  8.5.0

Returns
  Promise<GraphicsObject[]> - All eligible graphics objects.

## ◆ 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 | Graphics_ObjectType - 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.

## ◆ getMeasureScaleRatio()

PDFPage::getMeasureScaleRatio | ( |  | ) |
| inline

Get the scale ratio for measuring.

Returns
  Promise<{scale:number,ratio:number,ratioMap:Array<{value:number,unit:string}>,unitName:string}> -

Since
  8.4.0
  interface TheResultType {
  scale: number, // scale
  ratio: number, // Measure ratio string. The string should be like: "1 inch = 1 ft",indicating that 1 inches in default user space is equivalent to 1 foot in real-world measurements.
  ratioMap: Array<{value:number,unit:string}>, // [{value:1,unit:'inch'},{value:1,unit:'ft'}]
  unitName: string, // A label for displaying the units. Please refer to @link Annot_Unit_Type @endlink
  }
  async function example(pdfPage) {
  let result:TheResultType = await pdfPage.getMeasureScaleRatio();
  return result
  }

## ◆ getPageBox()

PDFPage::getPageBox | ( |  | boxType | ) |
| inline

Get page box rectangle (in PDF coordinate system).

Since
  7.4.0

Parameters

  boxType | Box_Type - 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

  point | object - Point on the page in PDF Point unit
  point.x | number - The X-axis coordinate with the origin at left-bottom corner of the PDF page
  point.y | number - The Y-axis coordinate with the origin at left-bottom corner of the PDF page
  mode | SNAP_MODE - the value be passed as array, it refers to PDFViewCtrl.constants.SNAP_MODE.

See also
  reverseDevicePoint

Returns
  Promise<{x: number, y: number, type: SNAP_MODE}> - 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

## ◆ getSuggestedFormDesignerRect()

PDFPage::getSuggestedFormDesignerRect | ( |  | point | ) |
| inline

Parameters

  point | number[] - Specifies PDF page point coordinate

Returns
  Promise<PDFRect> - The rect in PDF coordinate.

## ◆ getTextContinuousRectsAtPoints()

PDFPage::getTextContinuousRectsAtPoints | ( |  | point1,
|  |  | point2,
|  |  | tolerance = `8`,
|  |  | start,
|  |  | end
| ) |  |
| inline

Gets the rectangle of the consecutively selected text.

Parameters

  point1 | [number, number] - Represents the start point in PDF coordinate system.
  point2 | [number, number] - Represents the end point in PDF coordinate system.
  tolerance | number - Represents the value for character hit detection. The default value is 8. The valid range is from 0.0f to 30.0f.
  start | number - The start index of the character. The default value is -1.
  end | number - The end index of the character. The default value is -1.

Returns
  Promise<PDFRect[]> - The text rectangles in PDF coordination system.

Since
  8.4.0

## ◆ getTextInRect()

PDFPage::getTextInRect | ( |  | rect,
|  |  | type = `0`
| ) |  |
| inline

Get the text within a rectangle, in PDF coordinate system.

Parameters

  rect | PDFRect - Specifies page rectangle in PDF coordination system.
  [type=0] | 0|1|2 - Specifies text type . 1 for pageText, 2 for fieldsText, 0 for both, The default value is 0.

Returns
  Promise<object> -

Example:
  {
  pageText: '...'// The text,
  fieldsText:[
  {
  id:'', // The field id
  text:'...' // The text
  }
  ]
  }

Example:
  async function example (pdfPage) {
  let result = await pdfPage.getTextInRect({left:0,right:100,top:100,bottom:0});
  return result;
  }

Since
  8.4.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 | Search_Flag - 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

  rotate | number - rotation degrees of thumbnail image, it should be 0,90,180 or 270

Returns
  Promise<{buffer: Uint8Array , width: number, height: number}> -

## ◆ getViewportRect()

PDFPage::getViewportRect | ( |  | ) |
| inline

Get the view port rectangle.

Returns
  PDFRect - PDF Rect. {left:number,right:number, top: number, bottom: number}

Since
  8.4.0
  async function example(pdfPage) {
  let rect = await pdfPage.getViewportRect();
  return rect;
  }

## ◆ getWidth()

PDFPage::getWidth | ( |  | ) |
| inline

Get page width. [Support in Server]

Returns
  number - Page width with point unit.

## ◆ getWordCount()

PDFPage::getWordCount | ( |  | ) |
| inline

Get the page's word count.

Returns
  Promise<number> - The page's word count.

Since
  10.0.0

## ◆ isCropped()

PDFPage::isCropped | ( |  | ) |
| inline

Use CropBox to determine whether the page is cropped.

Since
  7.4.0

Returns
  boolean -

## ◆ 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 | Array<{left:number;right:number;top:number;bottom:number;}> - 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<Annot[]> - An Annot array of new added annotations.

## ◆ pasteAnnot()

PDFPage::pasteAnnot | ( |  | srcAnnot,
|  |  | position
| ) |  |
| inline

Paste annotation at the specified position.

Parameters

  srcAnnot | Annot - Indicates the annotation which will be pasted.
  position | {x:number,y:number} - The specified position, in PDF coordinate system.

Note
  Not support strikeout, highlight, squiggly, underline, caret, popup annotations, and Widget.

Returns
  Promise<Annot[]> - An Annot array of new added annotations.

Since
  9.0.0
  async function example (pdfPage) {
  let annots = await pdfPage.getAnnots();
  let newAnnots= await pdfPage.pasteAnnot(annots[0],{x:0,y:pdfPage.getHeight()});
  return newAnnots;
  }

## ◆ removeAllAnnot()

PDFPage::removeAllAnnot | ( |  | ) |
| inline

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

Returns
  Promise<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 | number - An number of the specifeid annotation which will be removed.

Returns
  Promise<Annot[]> -

Since
  8.1.0

## ◆ removeGraphicsObject()

PDFPage::removeGraphicsObject | ( |  | obj | ) |
| inline

Remove the specified graphic object.

Parameters

  obj | GraphicsObject - Specify the page object to be removed.

Returns
  Promise<void> - 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<{width: number, height: number, buffer: ArrayBuffer}> - An object represents information related to a page image and contains three properties: width, height, and buffer. The 'width' and 'height' properties are both numbers, representing the dimensions of the image in pixels. The 'buffer' property is an ArrayBuffer containing raw data for each pixel's color value in the image. This data of 'buffer' can be rendered onto a canvas using the CanvasRenderingContext2D createImageData and putImageData methods.

## ◆ 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.
  [rotate=0] | number - Rotation Angle. Only support multiples of 90. The other values default to 0.

Returns
  PDFRect - PDF page rectangle

## ◆ setMeasureScaleRatio()

PDFPage::setMeasureScaleRatio | ( |  | storeInPage,
|  |  | unitName,
|  |  | ratio,
|  |  | scale
| ) |  |
| inline

Set the scale ratio for measuring.

Parameters

  storeInPage | boolean - True means the measurement data is stored in the current page, otherwise not.
  unitName | string - A label for displaying the units. Please refer to Annot_Unit_Type
  ratio | string - Measure ratio string. The string should be like: "1 inch = 1 ft",indicating that 1 inches in default user space is equivalent to 1 foot in real-world measurements.
  scale | number - Measure scale.

Returns
  Promise<Annot[]> - Annot objects of page annotations whose measuring data has been updated.

Since
  8.4.0
  async function example(pdfPage) {
  let annots = await pdfPage.setMeasureScaleRatio(true,"inch","1 inch = 1 ft",2);
  return annots
  }

## ◆ setPageSize()

PDFPage::setPageSize | ( |  | width,
|  |  | height
| ) |  |
| inline

Set the page size and triggers the DataEvents.pagesBoxChanged event after completion.

Parameters

  width | number - A positive number representing the new width of the page.
  height | number - A positive number representing the new height of the page.

See also
  DataEvents.pagesBoxChanged

Since
  9.0.0

Returns
  Promise<void> -

## ◆ 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
  )
  }

## ◆ splitTextInRect()

PDFPage::splitTextInRect | ( |  | rect,
|  |  | limit
| ) |  |
| inline

Split the text in the specified rectangle.

Note
  If page editor and touchup are not deactivated, unexperted error will happen.

Parameters

  rect | PDFRect - The rectangle in PDF coordinate system.
  limit | number - The number of words used to split the text objects that intersects the specified rectangle. It should not be negative value. 0 means the text objects will not be further split and will be grouped into a single text object.

Returns
  Promise<{charCount:number,rect:PDFRect,text:string}[]> - The text objects.

Example:
  [{
  charCount:number, // The number of characters in the text object.
  rect:PDFRect, // The rectangle in PDF coordinate system.
  text:string, // The text content.
  }]

Example:
  async function example(pdfPage) {
  let rect = {left: 83, top: 362, right: 650, bottom: 258};
  let limit = 3;
  let texts = await pdfPage.splitTextInRect(rect, limit);
  return texts;
  }

Since
  11.0.0

@2025 Foxit Software Incorporated. All rights reserved.