FoxitPDFSDKforWeb  v10.0.0
Foxit PDF SDK for Web
PDFPageRender Class Reference

PDF page renderer. More...

Inherits Render.

Public Member Functions

 getAnnotRender (name)
 Gets annot render with specified name. More...
 
 getHandlerDOM ()
 Get jquery object. More...
 
 getPDFDoc ()
 Get PDF doc. More...
 
 getPDFPage ()
 Get pdf page. More...
 
 getScale ()
 Get page scale without PDF coordinate to Device coordinate. More...
 
 getSnapshot (left, top, width, height)
 Capture the picture of the specified area on the page [Not support in Server] More...
 
 getWatermarkConfig ()
 Gets the page watermark information. [Not support in Server] More...
 
 reverseDeviceRect (deviceRect)
 Transform PDF page device rectangle to PDF page rectangle. More...
 
 setWatermarkConfig (watermarkConfig)
 Sets the page watermark information. [Not support in Server] More...
 
async transformPoint (options)
 Transforms the options.point from the specified srcType to the destType. More...
 

Detailed Description

PDF page renderer.

Member Function Documentation

◆ getAnnotRender()

PDFPageRender::getAnnotRender (   name)
inline

Gets annot render with specified name.

Parameters
namestring|number - annotation name, It is recommended to use object number.
Returns
AnnotRender|null - Returns null when not found. If the page has not been rendered, null is returned

◆ getHandlerDOM()

PDFPageRender::getHandlerDOM ( )
inline

Get jquery object.

Returns
HTMLElement - HTMLElement
Since
7.3.0

◆ getPDFDoc()

PDFPageRender::getPDFDoc ( )
inline

Get PDF doc.

Returns
PDFDoc

◆ getPDFPage()

PDFPageRender::getPDFPage ( )
inline

Get pdf page.

Returns
Promise<PDFPage>

◆ getScale()

PDFPageRender::getScale ( )
inline

Get page scale without PDF coordinate to Device coordinate.

Returns
number

◆ getSnapshot()

PDFPageRender::getSnapshot (   left,
  top,
  width,
  height 
)
inline

Capture the picture of the specified area on the page [Not support in Server]

Parameters
leftnumber - The X-axis offset in the upper-left corner of the page in device pixels.
topnumber - The Y-axis offset in the upper-left corner of the page in device pixels.
widthnumber - Area width in device pixels.
heightnumber - Area width in device pixels.
See also
PDFPage.getDevicePoint
Returns
Promise<Blob> - The data of the specified area.
Since
8.2.0

◆ getWatermarkConfig()

PDFPageRender::getWatermarkConfig ( )
inline

Gets the page watermark information. [Not support in Server]

Returns
object|object[] - Page watermarking configuration.

◆ reverseDeviceRect()

PDFPageRender::reverseDeviceRect (   deviceRect)
inline

Transform PDF page device rectangle to PDF page rectangle.

Parameters
deviceRectDeviceRect - Indicates PDF page device rectangle.
Returns
Promise<PDFRect> - PDF page rectangle

◆ setWatermarkConfig()

PDFPageRender::setWatermarkConfig (   watermarkConfig)
inline

Sets the page watermark information. [Not support in Server]

Parameters
watermarkConfigRecord<string,any>|Array<Record<string,any>> - Page watermarking configuration. * Example:
[{
type:"text",
content:"This is a watermark",
watermarkSettings:{
position:"TopLeft",
offsetX:0,
offsetY:0,
scaleX:1,
scaleY:1,
rotation:45,
opacity:100
},
watermarkTextProperties:{
font:"Microsoft Yahei",
fontSize:20,
color:"#000000",
fontStyle:"normal",
lineSpace:10,
alignment:"center"
}
}]
watermarkConfig.typestring - Specifies watermark's type. One of following values: 1."text" represents a text type watermark.
2."image" represents the image type watermark.
watermarkConfig.contentstring - Specifies watermark's type. One of following values: 1.text type:<string> Text type watermark string.
2.image type:<DataURL> Image of DataURL.
[watermarkConfig.isMultiline=false]boolean - Whether multiline watermark tiling is supported. If the 'type' is image, the larger image requires compression, which may cause distortion
[watermarkConfig.rowSpace=0]number - The row spacing for multiple lines of watermark. In points. The default value is 0. It will work while the parameter "watermarkConfig.isMultiline" is true.
[watermarkConfig.columnSpace=0]number - The column spacing for multiple lines of watermark. In points. The default value is 0. It will work while the parameter "watermarkConfig.isMultiline" is true.
[watermarkConfig.watermarkSettings]object - Watermark related configuration.
[watermarkConfig.watermarkSettings.position='Center']string - Position of watermark. Default value is "Center". Available values are listed below.
1."TopLeft":Position: top left.
2."TopCenter":Position: top center.
3."TopRight":Position: top right.
4."CenterLeft":Position center left.
5."Center":Position: center.
6."CenterRight":Position: center right.
7."BottomLeft":Position: bottom left.
8."BottomCenter":Position: bottom center.
9."BottomRight":Position: bottom right.
**:** This property will work while the parameter "watermarkConfig.isMultiline" is not true.
[watermarkConfig.watermarkSettings.offsetX=0]number - Horizontal offset.The default value is 0.
It will not work while the parameter "watermarkConfig.isMultiline" is true.
[watermarkConfig.watermarkSettings.offsetY=0]number - Vertical offset.The default value is 0.
It will not work while the parameter "watermarkConfig.isMultiline" is true.
[watermarkConfig.watermarkSettings.scaleX=1]number - The horizontal scale coefficient for the watermark image. This parameter affects the horizontal scaling of the watermark and does not impact row spacing. The default value is 1.
[watermarkConfig.watermarkSettings.scaleY=1]number - The vertical scale coefficient for the watermark image. This parameter affects the vertical scaling of the watermark and does not impact column spacing. The default value is 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 - Unique configuration for text watermarking.
[watermarkConfig.watermarkTextProperties.font]string - Font Name. It should be a CSS font. The default value is "Microsoft Yahei".
[watermarkConfig.watermarkTextProperties.fontSize=20]number - Font size.The default value is 20.
[watermarkConfig.watermarkTextProperties.color]string - Font color.The default value is "#000000".
[watermarkConfig.watermarkTextProperties.fontStyle='normal']string - The default value is "normal". Available values are listed below.
1."normal":Watermark font style: normal.
2."underline":Watermark font style: with underline.
[watermarkConfig.watermarkTextProperties.lineSpace=10]number - Line spacing.The default value is 10.
[watermarkConfig.watermarkTextProperties.alignment='center']string - Alignment. The default value is "center". Available values are listed below.
1."left":Left alignment.
2."center":Center alignment.
3."right":Right alignment.

◆ transformPoint()

async PDFPageRender::transformPoint (   options)
inline

Transforms the options.point from the specified srcType to the destType.

Parameters
optionsobject
options.pointobject - The user input point to be converted.
options.point.xnumber - The x-axis coordinate value.
options.point.ynumber - The y-axis coordinate value.
options.srcTypePagePointType - Indicates the source type of point.
options.destTypePagePointType - Indicates the target type of the coordinate point.
Returns
Promise<{x:number, y:number}> - Device point coordinate: [x, y].
Since
8.5.0
Note
This function calculates based on the current view and doesn't accept the parameter of a given scale or rotation value.

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