FoxitPDFSDKforWeb  v9.2.1
Foxit PDF SDK for Web
PDFDocRender Class Reference

The class that controls PDF document rendering. More...

Inherits Render.

Public Member Functions

 disableDragToScroll ()
 Disables page scrolling by dragging, which can be enabled via the enableDragToScroll() API after being disabled. More...
 
 enableDragToScroll ()
 Enables page scrolling by dragging. More...
 
 getBoundingClientRects ()
 Get bounding client rects of visible pages. More...
 
 getCurrentPageIndex ()
 get current page index More...
 
 getCurrentViewMode ()
 Returns the current view mode instance. More...
 
 getHandlerDOM ()
 Get jquery object. More...
 
 getOffsetInfo ()
 get current pdfdoc offset info More...
 
 getPDFDoc ()
 
 getRotation ()
 Obtains the view rotation angle of current document. The result returned is one of these values: 0, 90, 180, 270. More...
 
 getScale ()
 Gets the current display multiple of the document. More...
 
 getUserPermission ()
 Gets permissions for the view's documents
It's the intersection of PDFDoc::getPermissions() and initialization parameter options.customs.getDocPermissions for the pdfviewer. More...
 
 getViewMode ()
 Gets the current view mode instance object. More...
 
 getWatermarkConfig ()
 Gets the document watermark information. [Not support in Server] More...
 
 goToPage (index,{x=0, y=0}={}, isPDFPoint=false)
 Jump to page. More...
 
 renderPages (pageIndexes, scale)
 Renders the specified page. More...
 
 setWatermarkConfig (watermarkConfig)
 Sets the document watermark information. [Not support in Server] More...
 

Detailed Description

The class that controls PDF document rendering.

Member Function Documentation

◆ disableDragToScroll()

PDFDocRender::disableDragToScroll ( )
inline

Disables page scrolling by dragging, which can be enabled via the enableDragToScroll() API after being disabled.

Returns
void
See also
enableDragToScroll
Since
8.5.0

◆ enableDragToScroll()

PDFDocRender::enableDragToScroll ( )
inline

Enables page scrolling by dragging.

Returns
void
See also
disableDragToScroll
Since
8.5.0

◆ getBoundingClientRects()

PDFDocRender::getBoundingClientRects ( )
inline

Get bounding client rects of visible pages.

Since
7.2.0
Returns
object[] -
[{
index:0,//page index
scale:1, //zoom ratio. This value can be used in PDFPage.render() only.
x:0,
y:0;
width:200,
height:200,
left:0,
right:200,
top:0,
bottom:200
}
...
]

◆ getCurrentPageIndex()

PDFDocRender::getCurrentPageIndex ( )
inline

get current page index

Returns
number -
Since
7.2.0

◆ getCurrentViewMode()

PDFDocRender::getCurrentViewMode ( )
inline

Returns the current view mode instance.

Returns
IViewMode|null - Returns null if the PDF document is unready to render, otherwise an IViewMode instance.

◆ getHandlerDOM()

PDFDocRender::getHandlerDOM ( )
inline

Get jquery object.

Returns
HTMLElement - HTMLElement
Since
7.3.0

◆ getOffsetInfo()

PDFDocRender::getOffsetInfo ( )
inline

get current pdfdoc offset info

Since
7.2.0
Returns
Promise<{index: number, left: number, top: number, scale: number}> -
index:current page index.
top:The Y-axis offset in the upper-left corner of the page in the PDF coordinate.
left: The X-axis offset in the upper-left corner of the page in the PDF coordinate.
scale: The specific scale of the page. rotate: The specific rotate of the page.

◆ getPDFDoc()

PDFDocRender::getPDFDoc ( )
inline

Get the PDF document object

Returns
PDFDoc -

◆ getRotation()

PDFDocRender::getRotation ( )
inline

Obtains the view rotation angle of current document. The result returned is one of these values: 0, 90, 180, 270.

Returns
number

◆ getScale()

PDFDocRender::getScale ( )
inline

Gets the current display multiple of the document.

Returns
Promise<number | 'fitWidth' | 'fitHeight'> -

◆ getUserPermission()

PDFDocRender::getUserPermission ( )
inline

Gets permissions for the view's documents
It's the intersection of PDFDoc::getPermissions() and initialization parameter options.customs.getDocPermissions for the pdfviewer.

Returns
UserPermission -
function example (PDFViewer, UserPermission) {
var pdfViewer = new PDFViewer({
customs: {
getDocPermissions: function (pdfDoc) {
// All users have read-only access only
var userPermission = new UserPermission();
userPermission.putCannotModifyAny();
return (userPermission).getValue();
}
}
});
...
var pdfDocRender = pdfViewer.getPDFDocRender();
if (pdfDocRender) {
pdfDocRender.getUserPermission().then(function (docViewerPermission) {
})
}
}
Since
7.1.0

◆ getViewMode()

PDFDocRender::getViewMode ( )
inline

Gets the current view mode instance object.

Returns
IViewMode|undefined - view mode instance object

◆ getWatermarkConfig()

PDFDocRender::getWatermarkConfig ( )
inline

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

Returns
object|object[] - Document watermarking configuration.

◆ goToPage()

PDFDocRender::goToPage (   index,
  {x=0, y=0} = {},
  isPDFPoint = false 
)
inline

Jump to page.

Parameters
indexnumber - page index.
[offset]object - The offset in the upper left corner.
offset.xnumber - The X-axis offset in the upper-left corner of the page.
offset.ynumber - The Y-axis offset in the upper-left corner of the page.
[isPDFPoint]boolean - If true, offset is the PDF coordinate; otherwise, the device coordinate.
Returns
Promise<void> -

◆ renderPages()

PDFDocRender::renderPages (   pageIndexes,
  scale 
)
inline

Renders the specified page.

Since
7.2.0
Parameters
pageIndexesnumber[] - page index array. eg:[0,1]
scalenumber|'fitWidth'|'fitHeight' - scale - Greater than zero.
If it's a string, you can only take these values ('fitWidth', 'fitHeight').
Returns
Promise<void> -

◆ setWatermarkConfig()

PDFDocRender::setWatermarkConfig (   watermarkConfig)
inline

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

Parameters
watermarkConfigobject|object[] - 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.type'text'|'image' - Specifies watermark's type. One of following values: 1."text" represents a text type watermark.
2."image" represents the image ty pe 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.pageStartnumber - The start page index. Valid range: from 0 to (pageCount - 1).
watermarkConfig.pageEndnumber - The end page index. Valid range: from 0 to (pageCount - 1).
[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=Position.center]Position - 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 - Horizontal scale coefficient.The default value is 1.
[watermarkConfig.watermarkSettings.scaleY=1]number - Vertical scale coefficient.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']'normal'|'underline' - 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']'left'|'center'|'right' - Alignment. The default value is "center". Available values are listed below.
1."left":Left alignment.
2."center":Center alignment.
3."right":Right alignment.

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