Welcome,

The Widget API: Properties

Property Type Description

Origin

Read Only

string

The origin portion of the URL used to make all underlying API requests. It will generally be of the form [protocol]://[servername]:[port].

Default Value: “https”//www.tweekit.io:443”

Path

Read Only

string

The path portion of the URL used for underlying API requests.

Default Value: /tweekit/api/image/preview/[docId]

docId

Read Only

number

An identifier for the document currently being displayed by the widget or null if a document has not been uploaded yet.

currentFile

Read Only

string

The name of the file last uploaded to the widget

tweeks

Read Only

object

The current crop points, x1, y1, x2, y2, and zoom factor

pageCount

Read Only

number

The number of pages in the document last uploaded to the widget

headers

Read & Write

object

An object of string name/value pairs to send with subsequent requests

pageNumber

Read & Write

number

An object of string name/value pairs to send with subsequent requests

Default Value: 1

backgroundColor

Read & Write

string

In some cases, like an elliptical crop or if the result dimensions are set larger than the crop dimensions, a background may be visible, use this property to set the color, specified in HTML RGB color notation ‘#ffffff’.

Default Value: #000000

elliptical

Read & Write

boolean

Whether or not the crop dimensions specify an elliptical crop as opposed to a rectangular crop.

Default Value: false

alpha

Read & Write

boolean

If true apply any alpha channel to the image.

Default Value: false

format

Read & Write

string

A format string for the preview image should be one of ‘gif’, ‘jpg’, or ‘png’.

Default Value: jpg

resultWidth

Read & Write

number

Width of the final result image

resultHeight

Read & Write

number

Height of the final result image

Example

var tweekit = new Tweekit('#tweekit-box') // get the Origin var the_origin = tweekit.origin // get the Path var the_path = tweekit.path // get the Doc Id var the_docId = tweekit.docId // get the Current File var the_the_docId = tweekit.currentFile // get the Tweeks or Tweekit crop coordinates var the_tweeks = tweekit.tweeks // get the Page Count var the_pageCount = tweekit.pageCount // get the current Header Settings or set a new Header Setting var the_current_header = tweekit.headers tweekit.headers = { 'Referrer Policy': 'strict-origin-when-cross-origin' } // get the current Page Number or set a new Page Number var the_pageNumber = tweekit.pageNumber tweekit.pageNumber = the_pageNumber + 1 // go to next page // get the current BG Color or set a to a new BG color var the_backgroundColor = tweekit.backgroundColor tweekit.backgroundColor = '#FF0000' // get the current Alpha State or set a new Alpha State var the_alpha = tweekit.alpha tweekit.alpha = false // get the current Format or set a new Format var the_format = tweekit.format tweekit.format = "pdf" // get the current Result Width or set a new Result Width var the_resultWidth = tweekit.resultWidth tweekit.resultWidth = 500 // get the current Result Width or set a new Result Width var the_resultHeight = tweekit.resultHeight tweekit.resultHeight = 900