FoxitPDFSDKforWeb  v10.0.0
Foxit PDF SDK for Web
GraphicsObject Class Reference
Inheritance diagram for GraphicsObject:
ImageObject PathObject TextObject

Public Member Functions

 getBitmap (scale, rotation=0, type='canvas')
 Render graphics object. More...
 
 getBorderColor ()
 Get the border color of this graphics object, for path object. More...
 
 getBorderDashes ()
 Get the dash array of this graphics object, for path object. More...
 
 getBorderStyle ()
 Get the border style of this path object, dash or solid. More...
 
 getBorderWidth ()
 Get the border width of this graphics object, for path object. More...
 
 getDeviceMatrix ()
 Get the device matrix of this graphics object, in device coordinate. More...
 
 getFillColor ()
 Get the fill color of this graphics object, for path object. More...
 
 getId ()
 Get the identity string of this graphics object. More...
 
 getMatrix ()
 Get the matrix of this graphics object, in PDF coordinate. More...
 
 getOpacity ()
 Get the opacity of this graphics object. More...
 
 getPDFPage ()
 Get the associated pdf page of this graphics object. More...
 
 getRect ()
 Get the rectangle of this graphics object. More...
 
 getType ()
 Get the type of this graphics object. More...
 
 moveToPosition (type, graphicObj)
 Sets the position of this graphics object. More...
 
 setBorderColor (value)
 Set the border color of this graphics object, for path object. More...
 
 setBorderStyle (value, dashes)
 Set the border style of this graphics object, for path object. More...
 
 setBorderWidth (value)
 Set the border width of this graphics object, for path object. More...
 
 setFillColor (value)
 Set the fill color of this graphics object, for path object. More...
 
 setMatrix (matrix)
 Set the matrix of this graphics object. More...
 
 setOpacity (value)
 Set the fill color of this graphics object. More...
 
 setRect (rect)
 Set the rectangle of this graphics object, move it to the specified rectangle. More...
 

Detailed Description

PDF graphics object

Member Function Documentation

◆ getBitmap()

GraphicsObject::getBitmap (   scale,
  rotation = 0,
  type = 'canvas' 
)
inline

Render graphics object.

Parameters
scalenumber - The specified page display scale.
rotationnumber - The page view rotation.
[type='canvas']'canvas'|'image'|'buffer' - The data type, valid value: 'canvas' | 'image' | 'buffer'.
Returns
Promise<HTMLCanvasElement|HTMLImageElement|ArrayBuffer> - The image data by the specified type.
var imageBuf = getBitmap(1,0,'buffer');
var blob = new Blob([imageBuf], {type: 'image/png'});
var url = URL.createObjectURL(blob);
Since
7.4.0

◆ getBorderColor()

GraphicsObject::getBorderColor ( )
inline

Get the border color of this graphics object, for path object.

Form XObjet graphics object, path graphics object and text graphics object can have this property.

Returns
number - The border color, format as 0xFFRRGGBB.
Since
7.4.0

◆ getBorderDashes()

GraphicsObject::getBorderDashes ( )
inline

Get the dash array of this graphics object, for path object.

Form XObjet graphics object, path graphics object and text graphics object can have this property.

Returns
number[] - The dash array.
Since
7.4.0

◆ getBorderStyle()

GraphicsObject::getBorderStyle ( )
inline

Get the border style of this path object, dash or solid.

Form XObjet graphics object, path graphics object and text graphics object can have this property.

Returns
number - The border style, 1 for dash, 0 for solid.
Since
7.4.0

◆ getBorderWidth()

GraphicsObject::getBorderWidth ( )
inline

Get the border width of this graphics object, for path object.

Form XObjet graphics object, path graphics object and text graphics object can have this property.

Returns
number - The border width.
Since
7.4.0

◆ getDeviceMatrix()

GraphicsObject::getDeviceMatrix ( )
inline

Get the device matrix of this graphics object, in device coordinate.

Returns
Matrix - The matrix object.
Since
7.4.0

◆ getFillColor()

GraphicsObject::getFillColor ( )
inline

Get the fill color of this graphics object, for path object.

Form XObjet graphics object, path graphics object and text graphics object can have this property.

Returns
number - The fill color, format as 0xFFRRGGBB.
Since
7.4.0

◆ getId()

GraphicsObject::getId ( )
inline

Get the identity string of this graphics object.

Returns
string - The string which identify the unique graphics object.
Since
7.4.0

◆ getMatrix()

GraphicsObject::getMatrix ( )
inline

Get the matrix of this graphics object, in PDF coordinate.

Returns
Matrix - The matrix object.
Since
7.4.0

◆ getOpacity()

GraphicsObject::getOpacity ( )
inline

Get the opacity of this graphics object.

Returns
number - The opacity value. Valid range: 0.0 to 1.0. 0.0 means full transparency and 1.0 means full opaque.
Since
7.4.0

◆ getPDFPage()

GraphicsObject::getPDFPage ( )
inline

Get the associated pdf page of this graphics object.

Returns
PDFPage - The pdf page object.
Since
7.4.0

◆ getRect()

GraphicsObject::getRect ( )
inline

Get the rectangle of this graphics object.

Returns
PDFRect - Specifies the rectangle on page in PDF coordination system.
Since
7.4.0

◆ getType()

GraphicsObject::getType ( )
inline

Get the type of this graphics object.

Returns
number - The type of graphics object, Graphics_ObjectType .
Since
7.4.0

◆ moveToPosition()

GraphicsObject::moveToPosition (   type,
  graphicObj 
)
inline

Sets the position of this graphics object.

Parameters
typePosType - The position Type. Please refer to PosType
graphicObjectobject - The other graphics object.
Note
When the value of type is first and last, the graphicObject is ignored and null can be passed. It is only valid when the value of type is before and after
Returns
Promise<void> -
function example(pdfViewer){
const page = await pdfViewer.getPDFDocRender().getPDFDoc().getPageIndex(0)
const pageCurrentObj = await page.getGraphicsObjectByIndex(1);
const pageDestObj = await page.getGraphicsObjectByIndex(2);
await pageCurrentObj.moveToPosition( PDFViewCtrl.PDF.constant.PosType.after,pageDestObj)
}
Since
7.6.0

◆ setBorderColor()

GraphicsObject::setBorderColor (   value)
inline

Set the border color of this graphics object, for path object.

Form XObjet graphics object, path graphics object and text graphics object can set this property.

Parameters
valuenumber - The border color, format as 0xFFRRGGBB.
Returns
Promise<void> - none.
Since
7.4.0

◆ setBorderStyle()

GraphicsObject::setBorderStyle (   value,
  dashes 
)
inline

Set the border style of this graphics object, for path object.

Form XObjet graphics object, path graphics object and text graphics object can set this property.

Parameters
valuenumber - The border style, 1 for dash, 0 for solid.
dashesnumber[] - The dash array.
Returns
Promise<void> -
Since
7.4.0

◆ setBorderWidth()

GraphicsObject::setBorderWidth (   value)
inline

Set the border width of this graphics object, for path object.

Form XObjet graphics object, path graphics object and text graphics object can set this property.

Parameters
valuenumber - The border width.
Returns
Promise<void>
Since
7.4.0

◆ setFillColor()

GraphicsObject::setFillColor (   value)
inline

Set the fill color of this graphics object, for path object.

Form XObjet graphics object, path graphics object and text graphics object can set this property.

Parameters
valuenumber - The fill color, format as 0xxxRRGGBB. 0 for no fill color, otherwise alpha will be set to 0xFF.
Returns
Promise<void> -
Since
7.4.0

◆ setMatrix()

GraphicsObject::setMatrix (   matrix)
inline

Set the matrix of this graphics object.

Returns
Matrix - The matrix object.
Since
7.4.0

◆ setOpacity()

GraphicsObject::setOpacity (   value)
inline

Set the fill color of this graphics object.

Parameters
valuenumber - The new opacity value. Valid range: 0.0 to 1.0. 0.0 means full transparency and 1.0 means full opaque.
Returns
Promise<void> - none.
Since
7.4.0

◆ setRect()

GraphicsObject::setRect (   rect)
inline

Set the rectangle of this graphics object, move it to the specified rectangle.

Parameters
rectPDFRect - Specifies the rectangle on page in PDF coordination system.
Since
7.4.0

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