|
FoxitPDFSDKforWeb
7.1.1
Foxit PDF SDK for Web
|
Use PDFViewCtrl for the entry file. More...
Public Member Functions | |
| close (before=this.customs.closeDocBefore, after=this.customs.closeDocAfter) | |
| Close the open document. More... | |
| constructor ({ preloadJR=true, preloadSR=false, libPath, jr, i18n, i18nOptions, eventEmitter=new EventEmitter(), minScale=0.1, maxScale=10, defaultScale='fitWidth', preloadedPages=1, scaleFrequency=4, tileSize=3600, StateHandlers=[], customs={}, keymap={}, Viewmodes=[], enableJS, stateHandlerConfig, watermarkConfig, actionOptions={}, defaultViewMode=continuousViewModeName, snapshotServer=new SnapshotServer({ uploadSnapshotAPIPath:'snapshot/upload' }), highPerformance=typeof WebAssembly==='object', }={}) | |
| Create a PDFViewer. More... | |
| createNewDoc (title="untitled.pdf", author="", pageSize={height:842, width:595}) | |
| Create a new pdf document. More... | |
| getAnnotManager () | |
| Get annotation component manager. More... | |
| getAnnotRender (pageIndex, name) | |
| GetAnnotRender PDFPageRender::getAnnotRender. More... | |
| getCurrentPDFDoc () | |
| Get current pdf doc object. More... | |
| getEnableJS () | |
| Checks if PDF js can be executed. More... | |
| getEventEmitter () | |
| Get event emitter. More... | |
| getPDFDocRender () | |
| GetPDFDocRender. More... | |
| getPDFPageRender (index) | |
| GetPDFPageRender PDFDocRender::getPDFPageRender. More... | |
| getStateHandlerManager () | |
| Get state handler manager. More... | |
| getViewModeManager () | |
| Get view mode manager. More... | |
| init (selector) | |
| Init PDFViewer. More... | |
| openPDFByFile (file, options={}, pdfEngine) | |
| Open the local document. More... | |
| openPDFByHttpRangeRequest (request, options={fileName:''}) | |
| Open either a URL document by HTTP range requests or an entire file depending on if the server enables range request or not. More... | |
| redraw (force) | |
| Redraw the page view. More... | |
| reopenPDFDoc (pdfDoc, options={}) | |
| When a document fails to open, you can call this method and reproduce the passing parameters to reopen the file that failed to open. More... | |
| setEnableJS (enable) | |
| Set whether JavaScript is allowed or not. More... | |
| setUserName (userName) | |
| Set the global username. More... | |
| zoomTo (scale) | |
| Zoom to the given scale. More... | |
Use PDFViewCtrl for the entry file.
|
inline |
Close the open document.
| {function} | before - Callback before closing the document, support Promise, do not close the document when returning false. The default value is the PDFViewer initialization parameter customs.closeDocBefore. |
| {function} | after - The callback after closing the document. The default value is the PDFViewer initialization parameter customs.closeDocAfter. |
|
inline |
Create a PDFViewer.
| options | {object} - The configuration required to create the PDFViewer. |
| options.jr | {object} - JR engine config. |
| options.jr.licenseKey | {string} - String of licenseKey information. |
| options.jr.licenseSN | {string} - String of licenseSN information. |
| options.jr.l | {string} - String of license information. If he is assigned a value, neither jr.licenseKey nor jr.licenseSN is valid |
| [options.jr.workerPath=options.libPath] | {string} - The JR engine worker path. If it's a relative path, it's relative to "options.lib". If it's url, it's url. |
| [options.jr.enginePath=options.libPath+'jr-engine'] | {string} - The JR engine path. If it's a relative path, it's relative to "options.lib". If it's url, it's url. |
| [options.jr.fontPath | = '../external/brotli'] {string} - The JR engine render fonts path. If it's a relative path, it's relative to options.lib. If it's url, it's url. If you don't want the font resources under external/brotil, you can use the fonts on our server by configuring http://webpdf.foxitsoftware.com/webfonts |
| [options.preloadJR=true] | {boolean} - Proload JR engine. |
| [options.libPath] | {string} - The PDFViewer lib package path. The default is the current page path. If it's a relative path, it's relative to "options.lib". If it's url, it's url. |
| [options.minScale=0.1] | {number} - Minimum magnification |
| [options.maxScale=10] | {number} - Maximum magnification |
| [options.defaultScale='fitWidth'] | {number|string} - Multiple of the default display. string enum: fitWidth, fitHeight |
| [options.scaleFrequency=4] | {number} - Set integers greater than or equal to 0. It will affect page rendering. The default value is 4, then 1/4=0.25, such as 1.1 times, is 1.25 times the size of the picture to reduce drawing overhead. The larger the value, the clearer it is, but the higher the performance penalty. If the value is set to 0, it is rendered in raw multiples, not scaled. The biggest performance penalty. |
| [options.tileSize=3600] | {number} - Size of tile display. The unit pixel. When the display area is larger than tileSize, it will be cut into tiles for display. The recommended range is 500-3000. The more blocks cut, the less efficient the display. |
| [options.i18n] | {i18next} - i18next instance https://www.i18next.com/ |
| [options.i18nOptions] | {object} - If options.i18n does not exist, options.i18n is generated through the options.i18nOptions configuration |
| [options.i18nOptions.initOption={ns:'viewer_'}] | {object} - Multilingual config. https://www.i18next.com/overview/configuration-options |
| [options.i18nOptions.path=options.libPath+'locales'] | {string} - Multilingual path. If it's a relative path, it's relative to options.lib. If it's url, it's url. |
| [options.eventEmitter] | {EventEmitter} - default: new EventEmitter(); eventemitter3 https://github.com/primus/eventemitter3 |
| [options.Viewmodes=[]] | {IViewMode[]} - View mode compontent. |
| [options.defaultViewMode='continuous-view-mode'] | {string} - Default is continuous view mode. |
| [options.customs] | {object} - Custom component. |
| [options.customs.closeDocBefore=function(){}] | {Function} - Callback before closing the document, support Promise, do not close the document when returning false. |
| [options.customs.closeDocAfter=function(){}] | {Function} - Callback after closing the document, support Promise. |
| [options.customs.getDocPermissions=function(doc){return | -1}] {Function} - Get user access permissions. -1 represents all permissions. |
| [options.customs.ScrollWrap=ScrollWrap] | {ScrollWrap} - The component that controls the roll. |
| [options.customs.PDFViewerRendering] | {PDFViewerRendering} - Called when the viewer rendering. |
| [options.customs.PDFDocRendering] | {PDFDocRendering} - Called when the doc rendering. |
| [options.customs.PDFPageRendering] | {PDFPageRendering} - Called when the page rendering. |
| [options.StateHandlers=[]] | {IStateHandler[]} - pdf viewer state handler. |
|
inline |
Create a new pdf document.
| title | {*} - {string} New pdf title, default value is "untitled.pdf". |
| author | {*} - {string} New Pdf author. |
| pageSize | {*} - {object} {height:842, width:595}. |
|
inline |
Get annotation component manager.
|
inline |
GetAnnotRender PDFPageRender::getAnnotRender.
| pageIndex | {number} page index |
| name | {string} annotation name |
|
inline |
Get current pdf doc object.
|
inline |
Checks if PDF js can be executed.
|
inline |
Get event emitter.
|
inline |
GetPDFDocRender.
|
inline |
GetPDFPageRender PDFDocRender::getPDFPageRender.
| index | {number} page index |
|
inline |
Get state handler manager.
|
inline |
Get view mode manager.
|
inline |
Init PDFViewer.
| {string|HTMLElement} | selector - jquery selector. pdf viewer dom host. |
|
inline |
Open the local document.
| file | {File|Blob|ArrayBuffer|TypeArray|ViewData} |
| options={} | {object} |
| [options.password] | {string} - document password |
| [options.encryptPassword] | {string} - The document's password is encrypted again. You can refer to the logic of path 'server/encrypt-password' to get your encryptPassword |
| [options.fileName=''] | {string} - document filename |
| [options.annotsJson] | {object} - Json format data for the initial annotation |
| [options.fdf] | {object} - Json format data for the initial annotation |
| [options.fdf.file] | {File|Blob|ArrayBuffer|TypeArray|ViewData} - Specify fdf file's stream for the initial annotation. |
| [options.fdf.type] | {number} - Specify data type which will be imported: 1 for form data, 2 for annotations. |
| [options.drm] | {object} When this value is set, the DRM decryption process is invoked. |
| [options.drm.isEncryptMetadata] | {boolean} A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata, and false means not to encrypt metadata. |
| [options.drm.subFilter] | {string} The sub filter of PDF document. |
| [options.drm.cipher] | {number} Cipher type. Please refer to values starting from Cipher_Type::cipherRC4 and this should be one of these values except Cipher_Type.cipherNone. |
| [options.drm.keyLength] | {number} The key length, in bytes. For Cipher_Type::cipherRC4 cipher, this value should be between 5 and 16. For Cipher_Type::cipherAES cipher, this value should be 16 or 32. |
| [options.drm.isOwner] | {boolean} A boolean value to decide whether current user is owner or not. true means current user is owner, and false means current user is not owner. |
| [options.drm.userPermissions] | {number} The user permissions. Please refer to values starting from User_Permissions::print and this can be one or combination of these values. |
| [options.drm.fileId] | {string} The file identity string. |
| [options.drm.initialKey] | {string} The user specified initial key for encryption. |
| [options.fileOpen] | {object} When this value is set, the fileOpen decryption process is invoked. |
| [options.fileOpen.encryptKey] | {array} Decrypt an array of charcodes for the key |
|
inline |
Open either a URL document by HTTP range requests or an entire file depending on if the server enables range request or not.
| request | {object} |
| request.range | {object} HTTP range requests, responseType = 'arraybuffer' |
| request.range.url | {string} Request the url of the file. The second parameter to XMLHttpRequest.open, default request.range.url, this URL is relative to the path of your HTML page. |
| [request.range.type='GET'] | {number} The first parameter to XMLHttpRequest.open, default GET |
| [request.range.user] | {number} The fourth parameter to XMLHttpRequest.open |
| [request.range.password] | {number} The fifth parameter to XMLHttpRequest.open |
| [request.range.headers] | {object} Set the request header for XMLHttpRequest. eg: XMLHttpRequest.setRequestHeader(x, request.header.headers.x) |
| [request.range.chunkSize=131072] | {number} Size of each Range sharding request. default 131072 = 128 *1024 = 128KB |
| [request.range.extendOptions] | {string} Set the response header to get additional options |
| [request.size] | {number} the size of the document |
| options={fileName:''} | {object} |
| [options.password] | {string} - document password |
| [options.encryptPassword] | {string} - The document's password is encrypted again. You can refer to the logic of path 'server/encrypt-password' to get your encryptPassword |
| [options.fileName=''] | {string} - document filename |
| [options.annotJson] | {object} - Json format data for the initial annotation |
| [options.fdf] | {object} - Json format data for the initial annotation |
| [options.fdf.file] | {File|Blob|ArrayBuffer|TypeArray|ViewData} - Specify fdf file's stream for the initial annotation. |
| [options.fdf.type] | {number} - Specify data type which will be imported: 1 for form data, 2 for annotations. |
| [options.drm] | {object} When this value is set, the DRM decryption process is invoked. |
| [options.drm.isEncryptMetadata] | {boolean} A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata, and false means not to encrypt metadata. |
| [options.drm.subFilter] | {string} The sub filter of PDF document. |
| [options.drm.cipher] | {number} Cipher type. Please refer to values starting from Cipher_Type::cipherRC4 and this should be one of these values except Cipher_Type.cipherNone. |
| [options.drm.keyLength] | {number} The key length, in bytes. For Cipher_Type::cipherRC4 cipher, this value should be between 5 and 16. For Cipher_Type::cipherAES cipher, this value should be 16 or 32. |
| [options.drm.isOwner] | {boolean} A boolean value to decide whether current user is owner or not. true means current user is owner, and false means current user is not owner. |
| [options.drm.userPermissions] | {number} The user permissions. Please refer to values starting from User_Permissions::print and this can be one or combination of these values. |
| [options.drm.fileId] | {string} The file identity string. |
| [options.drm.initialKey] | {string} The user specified initial key for encryption. |
| [options.fileOpen] | {object} When this value is set, the fileOpen decryption process is invoked. |
| [options.fileOpen.encryptKey] | {array} Decrypt an array of charcodes for the key |
|
inline |
Redraw the page view.
| force | - {booleam} true: Forced to refresh |
|
inline |
When a document fails to open, you can call this method and reproduce the passing parameters to reopen the file that failed to open.
| pdfDoc | - {PDFDoc} |
| options | - {object} |
| options={fileName:''} | {object} |
| [options.password] | {string} - document password |
| [options.encryptPassword] | {string} - The document's password is encrypted again. You can refer to the logic of path 'server/encrypt-password' to get your encryptPassword |
| [options.fileName=''] | {string} - document filename |
| [options.annotJson] | {object} - Json format data for the initial annotation |
| [options.fdf] | {object} - Json format data for the initial annotation |
| [options.fdf.file] | {File|Blob|ArrayBuffer|TypeArray|ViewData} - Specify fdf file's stream for the initial annotation. |
| [options.fdf.type] | {number} - Specify data type which will be imported: 1 for form data, 2 for annotations. |
| [options.drm] | {object} When this value is set, the DRM decryption process is invoked. |
| [options.drm.isEncryptMetadata] | {boolean} A boolean value to decide whether to encrypt metadata or not. true means to encrypt metadata, and false means not to encrypt metadata. |
| [options.drm.subFilter] | {string} The sub filter of PDF document. |
| [options.drm.cipher] | {number} Cipher type. Please refer to values starting from Cipher_Type.cipherRC4 and this should be one of these values except Cipher_Type::cipherNone. |
| [options.drm.keyLength] | {number} The key length, in bytes. For SecurityConstsPDF::cipherRC4 cipher, this value should be between 5 and 16. For SecurityConstsPDF::cipherAES cipher, this value should be 16 or 32. |
| [options.drm.isOwner] | {boolean} A boolean value to decide whether current user is owner or not. true means current user is owner, and false means current user is not owner. |
| [options.drm.userPermissions] | {number} The user permissions. Please refer to values starting from User_Permissions::print and this can be one or combination of these values. |
| [options.drm.fileId] | {string} The file identity string. |
| [options.drm.initialKey] | {string} The user specified initial key for encryption. |
| [options.fileOpen] | {object} When this value is set, the fileOpen decryption process is invoked. |
| [options.fileOpen.encryptKey] | {array} Decrypt an array of charcodes for the key |
|
inline |
Set whether JavaScript is allowed or not.
| enable | {boolean} True allows JavaScript to execute, and false does the opposite |
|
inline |
Set the global username.
| userName | {string} Set the global username that will be used for the annotation title |
|
inline |
Zoom to the given scale.
| {number|string} | scale - Greater than zero. If it's a string, you can only take these values ('fitWidth', 'fitHeight'). |