WebViewer Instance Core namespace.
The namespace containing WebViewer's core user controls, including DocumentViewer control and the Document class.
Example
webViewerInstance.Core.someProperty webViewerInstance.Core.someAPI()
Classes
- AccessibleReadingOrderManager
- AnnotationHistoryManager
- AnnotationManager
- Bookmark
- ContentEditHistoryManager
- ContentEditManager
- DisplayMode
- DisplayModeManager
- Document
- DocumentViewer
- EditBoxManager
- EventHandler
- FormFieldCreationManager
- MeasurementManager
- Scale
- VirtualDisplayMode
- WebViewerServerAnnotationManager
Namespaces
Members
-
<static> annotationManager
-
AnnotationManager instance
Example
WebViewer(...) .then(function(instance) { const annotationManager = instance.Core.annotationManager; }); -
<static> BackendTypes
-
The types of backend workers.
Properties:
Name Type Description ASMstring 'asm' Use of ASM.js worker. WASMstring 'ems' Use of the WebAssembly worker (or ASM.js on non-wasm browsers). THREADED_WASMstring 'wasm-threads' Use of threaded WebAssembly worker. -
<static> ColorPostProcessMode
-
Represents the different color post processing options that can used in the updateRasterizerOptions function.
Properties:
Name Type Description NONEnumber No post processing. This is the default setting INVERTnumber Inverted color mode GRADIENT_MAPnumber Gradient color mode NIGHT_MODEnumber Night mode -
<static> DisplayModes
-
Display modes that control how the document's page are displayed
Properties:
Name Type Description Singlestring Displays one page at a time. Continuousstring Displays all the pages in a scrolling view in one column. Facingstring Displays up to two pages at a time, side by side. FacingContinuousstring Displays all pages in a scrolling view in two columns. Coverstring Displays all pages in a scrolling view in two columns. The first row has a single page in the second column. CoverFacingstring Same as the Cover display mode except that it is not a scrolling view. Customstring Any custom display mode. -
<static> documentViewer
-
DocumentViewer instance
- See:
Example
WebViewer(...) .then(function(instance) { const documentViewer = instance.Core.documentViewer; }); -
<static> EMPTY_XFDF
-
An XFDF string for no annotations.
-
<static> FONT_STYLES
-
Represents the font style for the watermark text
Properties:
Name Type Description BOLDstring specifies that the text should be bolded ITALICstring specifies that the text should be italicized UNDERLINEstring specifies that the text should be underlined -
<static> getLegacyOfficeWorkerPath
-
Get the location of the Legacy Office worker (WebB2XOfficeWorker).
-
<static> getOfficeEditorWorkerPath
-
Get the location of the OfficeEditor worker files OfficeEditorModule.js, OfficeEditorWorkerWasm.br.js.mem and OfficeEditorWorkerWasm.br.wasm files
-
<static> getOfficeWorkerPath
-
Get the location of the Office worker.
-
<static> MarkedStates
-
Represents the different Marked state values that you can apply to annotation status.
Properties:
Name Type Description Markedstring Marked State Unmarkedstring Unmarked State -
<static> OverprintPreviewMode
-
Represents the different overprint preview options that can used in the updateRasterizerOptions function.
Properties:
Name Type Description OFFnumber Disable overprint ONnumber Enable overprint PDFX_ONnumber Enable overprint for PDF/X documents SEPARATION_RENDERnumber Enable rasterizing separations -
<static> PageRotation
-
Represents the different page rotation values that you can apply to pages.
Properties:
Name Type Description E_0number 0 degree rotation E_90number 90 degree rotation E_180number 180 degree rotation E_270number 270 degree rotation -
<static> ReviewStates
-
Represents the different review state values that you can apply to annotation status.
Properties:
Name Type Description Acceptedstring Accepted State Rejectedstring Rejected State Cancelledstring Cancelled State Completedstring Completed State Nonestring None State -
<static> SaveOptions
-
Represents the different save option values that you can use in the getFileData function.
Properties:
Name Type Description INCREMENTALnumber Saves new data to the end of the file REMOVE_UNUSEDnumber Removes unused data when saving HEX_STRINGSnumber Save strings in hexadecimal format OMIT_XREFnumber Do not save cross reference table LINEARIZEDnumber Optimize data for speed and remove unused data COMPATIBILITYnumber Maximize compatibility with older PDF consumers (e.g. the file will not use object and compressed XREF streams) -
<static> setBasePath
-
Setting the base path that relatively loading documents will be relative to.
-
<static> setLegacyOfficeWorkerPath
-
Set the location of the Legacy Office worker (WebB2XOfficeWorker). This will override the location specified by Core.setWorkerPath for Legacy Office worker files.
-
<static> setOfficeEditorWorkerPath
-
Set the location of the OfficeEditor workers for OfficeEditorModule.js, OfficeEditorWorkerWasm.br.js.mem and OfficeEditorWorkerWasm.br.wasm files. This will override the location specified by Core.setWorkerPath for OfficeEditor worker files.
-
<static> setOfficeWorkerPath
-
Set the location of the Office worker. This will override the location specified by Core.setWorkerPath for Office worker files.
-
<static> StateModel
-
Represents the different state models that you can apply to annotation.
Properties:
Name Type Description Markedstring Marked State Reviewstring Review State -
<static> SupportedFileFormats
-
Represents all the supported file formats in WebViewer
Properties:
Name Type Description CLIENTArray.<string> Supported file formats when using WebViewer client side rendering SERVERArray.<string> Supported file formats when using WebViewer with WebViewer Server -
<static> TextExtractorProcessingFlags
-
Represents the different processing option values to direct the flow of content recognition algorithms that you can use in the setTextExtractorProcessingFlags function.
Properties:
Name Type Description NO_LIGATURE_EXPnumber Disables expanding of ligatures using a predefined mapping. Default ligatures are: fi, ff, fl, ffi, ffl, ch, cl, ct, ll, ss, fs, st, oe, OE NO_DUP_REMOVEnumber Disables removing duplicated text that is frequently used to achieve visual effects of drop shadow and fake bold PUNCT_BREAKnumber Treat punctuation (e.g. full stop, comma, semicolon, etc.) as word break characters REMOVE_HIDDEN_TEXTnumber Enables removal of text that is obscured by images or rectangles NO_INVISIBLE_TEXTnumber Enables removing text that uses rendering mode 3 (i.e. invisible text), which is usually used in 'PDF Searchable Images' (i.e. scanned pages with a corresponding OCR text) NO_WATERMARKSnumber Enables removal of text that is marked as part of a Watermark layer EXTRACT_USING_ZORDERnumber Use Z-order as reading order for text
Methods
-
<static> areObjectURLBlobsEnabled()
-
Retrieves the current boolean value of the internal property objectURLBlobsDisabled
Returns:
- Type
- boolean
-
<static> BaseDocument()
-
BaseDocument is used to alert if a Document implementation is not following the Document interface.
-
<static> createDatePicker(options)
-
Create DatePicker UI
Parameters:
Name Type Description optionsObject An object to set the configuration of the date picker Properties
Name Type Description fieldHTMLElement The HTML form field the date picker should be bound to containerHTMLElement DOM node to render calendar into onDateSelectedCore.onDateSelected Function that is called when the date is selected from the date picker UI formatstring the date format showed after select date -
<static> createDocument(src [, options])
-
Creates an initialized Core.Document instance.
Parameters:
Name Type Argument Description srcstring | File | ArrayBuffer | Blob | Core.PDFNet.PDFDoc Source parameter, path/url to document or File. optionsCore.CreateDocumentOptions <optional>
Create document options. Returns:
Promise that resolves when doc.loadAsync has been successfully called and returns Core.Document instance.- Type
- Promise.<Core.Document>
-
<static> disableEmbeddedJavaScript()
-
Disables the execution of embedded JavaScript
-
<static> disableFullPDF()
-
Disable the use of the full version of the PDFNetJS if it had been previously enabled.
-
<static> disableLogs(disabled)
-
Enables or disables all logs coming from WebViewer.
Parameters:
Name Type Description disabledboolean Whether or not to disable all WebViewer logs. Defaults to true -
<static> disableObjectURLBlobs(value)
-
Sets the internal boolean property of objectURLBlobsDisabled. If false, then the URL.createObjectUrl API will be used to instantiate an uncompressed Blob instance of the appropriate PDF worker file (Note that this goes against the Content-Security-Policy (CSP) rule "script-src blob:"). If true, then uncompressed JavaScript files will be loaded without instantiating a Blob.
Parameters:
Name Type Description valueboolean The boolean value to set the internal boolean property of objectURLBlobsDisabled. -
<static> disableOptimizedWorkers()
-
Set flag to indicate that the optimized workers can not be used.
- See:
-
- Core.enableOptimizedWorkers for more details.
-
<static> disableStrictAnnotationFontMatching(annotationManager)
-
Disable strict annotation font matching. When disabled, the font of freetext annotation in WebViewer will use the fallback font selected by browser if the font cannot be applied to the text. This could cause inconsistency between the font of freetext annotation in WebViewer and the font in the saved file.
Parameters:
Name Type Description annotationManagerCore.AnnotationManager The annotationManager of current documentViewer -
<static> enableEmbeddedJavaScript()
-
Enables the execution of embedded JavaScript
-
<static> enableFullPDF()
-
Enable or disable use of the full version of PDFNetJS. the parameter is deprecated since version 8.0
-
<static> enableOptimizedWorkers()
-
Set flag to indicate that the optimized workers can be used. These workers require some wasm features, e.g. Fixed-Width SIMD, Exception Handling, Bulk Memory Operations. If the browser doesn't support these features, this will have no effect.
-
<static> enableStrictAnnotationFontMatching(annotationManager)
-
Enable strict annotation font matching. When enabled, the font of freetext annotation in WebViewer should be matched with the font in the saved file. This is to handle the case that browser fallback font is not the same as the fallback font selected by Core in the saved file.
Parameters:
Name Type Description annotationManagerCore.AnnotationManager The annotationManager of current documentViewer -
<static> enableWorkerLogs(enabled)
-
Enables or disables logs from the PDF worker.
Parameters:
Name Type Description enabledboolean Whether or not to enable PDF worker logs. Defaults to false. -
<static> forceBackendType(backendType)
-
Set default backend type. This method can be used for forced backend type for specific workers, for example, "ems" for Emscripten worker type
Parameters:
Name Type Description backendTypestring Value for default backend type, e.g. asm, ems, wasm-threads, jsworker. -
<static> getAllowedFileExtensions()
-
Get the array of allowed file extensions. An empty array indicates all supported file extensions are allowed.
-
<static> getBuild()
-
Returns the specific hashed commit id that is used to build the current WebViewer version.
Returns:
A hashed commit id- Type
- string
-
<static> getCanvasMultiplier()
-
Gets the default multiplier used for rendering pages with document.loadCanvas. Higher multipliers mean that pages will be rendered at higher resolutions. The default value is the browser's devicePixelRatio
Returns:
The current value of the canvas multiplier- Type
- number
-
<static> getCurrentOfficeBackendType()
-
Gets the current backend type being used.
Returns:
Returns "asm" if ASM.js is being forced, "ems" if Emscripten is being used, "wasm-threads" if threaded Wasm is being used and undefined if nothing is being used yet- Type
- string
-
<static> getCurrentPDFBackendType()
-
Gets the current backend type being used.
Returns:
Returns "asm" if ASM.js is being forced, "ems" if Emscripten is being used, "wasm-threads" if threaded Wasm is being used and undefined if nothing is being used yet- Type
- string
-
<static> getCurrentPDFBackendType()
-
Gets the current backend type loaded or being loaded
Returns:
Returns "asm" if ASM.js is being forced, "ems" if Emscripten is being used or "wasm-threads" if threaded Wasm is being used- Type
- Promise.<string>
-
<static> getDefaultBackendType()
-
Gets the default pdf backend type that should be used for this browser.
Returns:
Returns a promise that resolve to a string. "ems" if Emscripten should be used, and "wasm-threads" if threaded Wasm should be used- Type
- Promise.<string>
-
<static> getDocumentViewers()
-
Gets an array of currently instantiated documentViewer objects.
Returns:
Array of documentViewer objects that are being used for the UI- Type
- Array.<Core.DocumentViewer>
Example
WebViewer(...) .then(function(instance) { const documentViewerList = instance.Core.getDocumentViewers(); documentViewerList.forEach(documentViewer => documentViewer.UI.loadDocument(doc, options)); }); -
<static> getExternalPath()
-
Get the location of external scripts.
Returns:
the prefix url external scripts.- Type
- string
-
<static> getFontPath()
-
Get the path of the font used in UI.
Returns:
the prefix url for font path.- Type
- string
-
<static> getHashParameter(property, defaultValue)
-
Gets the value of the specified hash parameter from the window URL
Parameters:
Name Type Description propertystring The property key from hash parameter defaultValueT Default return value Returns:
A value of the hash parameter- Type
- T
-
<static> getLegacyOfficeAsmPath()
-
Get the location of the LegacyOffice asm worker.
Returns:
the prefix url for WebB2XOfficeWorker.br.js.mem.- Type
- string
-
<static> getLegacyOfficeResourcePath()
-
Get the location of the Legacy Office resource worker.
Returns:
the prefix url for WebB2XOfficeWorker.js- Type
- string
-
<static> getLocalWorkerPath()
-
Get the location of the local worker files.
Returns:
the path to CORSWorker.js/CoreWorker.js- Type
- string
-
<static> getOfficeAsmPath()
-
Get the location of the Office asm worker.
Returns:
the prefix url for WebOfficeWorker.br.js.mem.- Type
- string
-
<static> getOfficeResourcePath()
-
Get the location of the Office worker.
Returns:
the prefix url for OfficeWorker.js- Type
- string
-
<static> getPDFAsmPath()
-
Get the location of the PDF asm.js file PDFNetC.gz.js.
Returns:
the prefix url for PDFNetC.gz.js.- Type
- string
-
<static> getPDFResourcePath()
-
Get the location of PDF resources.
Returns:
the prefix url for PDFNetC.js.mem and PDFNet.res.- Type
- string
-
<static> getPDFWorkerPath()
-
Get the location of the PDF worker.
Returns:
the prefix url for PDFworker.js- Type
- string
-
<static> getResourcesPath()
-
Gets the path to the resources folder
Returns:
The path to the resources folder- Type
- string
-
<static> getScrollLeft(ele)
-
Gets the scrollLeft value for the element. Takes into account right to left scrolling direction if applicable.
Parameters:
Name Type Description eleElement An HTML element to retrieve the scrollLeft value from Returns:
The scrollLeft value of the element- Type
- number
-
<static> getVersion()
-
Returns the WebViewer version.
Returns:
WebViewer version- Type
- string
-
<static> getWebViewerServerAnnotationManager()
-
Gets an instance of WebViewerServerAnnotationManager
Returns:
Resolves with a new instance of WebViewerServerAnnotationManager- Type
- Promise.<Core.WebViewerServerAnnotationManager>
-
<static> getWorkerPath()
-
Gets the path to the Web Worker JavaScript file
Returns:
The path to the worker- Type
- string
-
<static> initLegacyOfficeWorkerTransports(officeType, workerHandlers)
-
Begins setup of Legacy Office Worker Object.
Parameters:
Name Type Description officeTypestring object representing an Office backend type ("ems" or "wasm-threads") workerHandlersobject object holding event and error handlers for the worker (workerLoadingProgress, emsWorkerError). Returns:
a promise that will be resolved when worker transport initialization is complete. -
<static> initOfficeEditorWorkerTransports(workerHandlers, l)
-
Begins setup of OfficeEditor Worker Object.
Parameters:
Name Type Description workerHandlersobject object holding event and error handlers for the worker (workerLoadingProgress, emsWorkerError). lstring The license key to use for this worker. If undefined, initialization will be done in demo mode. Returns:
a promise that will be resolved when worker transport initialization is complete. -
<static> initOfficeWorkerTransports(officeType, workerHandlers, l)
-
Begins setup of Office Worker Object.
Parameters:
Name Type Description officeTypestring object representing an Office backend type ("ems" or "wasm-threads") workerHandlersobject object holding event and error handlers for the worker (workerLoadingProgress, emsWorkerError). lstring The license key to use for this worker. If undefined, initialization will be done in demo mode. Returns:
a promise that will be resolved when worker transport initialization is complete. -
<static> initPDFWorkerTransports(pdfBackendType, workerHandlers, l)
-
Begins setup of PDF Worker Object.
Parameters:
Name Type Description pdfBackendTypestring object representing an PDF backend type ("asm", "ems" or "wasm-threads") workerHandlersobject object holding event and error handlers for the worker (workerLoadingProgress, emsWorkerError). lstring The license key to use for this worker. If undefined PDFNet will be initialized in demo mode. Returns:
a promise that will be resolved when worker transport initialization is complete. -
<static> isBlendModeSupported(type)
-
Check if a composite operation is supported
Parameters:
Name Type Description typestring Composite operation to check Returns:
True if if the input composite operation is supported, false otherwise- Type
- boolean
-
<static> isDemoMode()
-
Returns whether demo mode is active or not. Must be called after the document is loaded or after the call to Core.initPDFWorkerTransports if you're calling it directly.
Returns:
true or false depending on whether the viewer is in demo mode or not- Type
- boolean
-
<static> isEmbeddedJavaScriptEnabled()
-
Returns whether embedded JavaScript is enabled or not
Returns:
Returns whether embedded JavaScript is enabled or not- Type
- boolean
-
<static> isFullPDFEnabled()
-
Returns whether the full version of PDFNetJS is enabled or not.
Returns:
returns true if the full version is enabled and false otherwise.- Type
- boolean
-
<static> isValidURI(uri)
-
Returns if the URI is valid
Parameters:
Name Type Description uristring The URI to check Returns:
True if the URI is valid, false otherwise- Type
- boolean
-
<static> officeToPDFBuffer(input, options)
-
Parameters:
Name Type Description inputstring | ArrayBuffer Either a url from which to download the file or an ArrayBuffer containing the file data. optionsObject An object containing conversion options Properties
Name Type Argument Description lstring <optional>
The license key with which to initialize the SDK extensionstring <optional>
The extension of the input file. Should be passed in if the input doesn't specify the file extension. Returns:
A promise that resolves to an ArrayBuffer containing the resulting PDF data.- Type
- ArrayBuffer
-
<static> preloadLegacyOfficeWorker(officeBackendType, workerHandlers)
-
Begins setup of Legacy Office Worker Object. This can be used to load the workers before a license key has been loaded.
Parameters:
Name Type Description officeBackendTypestring object representing an Office backend type ("ems" or "wasm-threads") workerHandlersobject object holding event and error handlers for the worker (workerLoadingProgress). Returns:
The worker object- Type
- object
-
<static> preloadOfficeWorker(officeBackendType, workerHandlers)
-
Begins setup of Office Worker Object. This can be used to load the workers before a license key has been loaded.
Parameters:
Name Type Description officeBackendTypestring object representing an Office backend type ("asm", "ems" or "wasm-threads") workerHandlersobject object holding event and error handlers for the worker (workerLoadingProgress). Returns:
The worker object- Type
- object
-
<static> preloadPDFWorker(pdfBackendType, workerHandlers)
-
Begins setup of PDF Worker Object. This can be used to load the workers before a license key has been loaded.
Parameters:
Name Type Description pdfBackendTypestring object representing a PDF backend type ("asm", "ems" or "wasm-threads") workerHandlersobject object holding event and error handlers for the worker (workerLoadingProgress). -
<static> resetLegacyOfficeWorker(worker)
-
Resets the worker so that the next time initLegacyOfficeWorkerTransports is called it will set up the worker transports with the specified worker.
Parameters:
Name Type Description workerobject The new worker to use the next time initLegacyOfficeWorkerTransports is called -
<static> resetOfficeWorker(worker)
-
Resets the worker so that the next time initOfficeWorkerTransports is called it will set up the worker transports with the specified worker.
Parameters:
Name Type Description workerobject The new worker to use the next time initOfficeWorkerTransports is called -
<static> resetWorker()
-
Resets the worker so that the next time initPDFWorkerTransports is called it will set up the worker transports.
-
<static> setAdvancedImageScaling(advanced)
-
Forces a higher level of accuracy in image downsampling at the expense of rendering performance. This function should be called before loading a document to ensure this setting is used.
Parameters:
Name Type Description advancedboolean if true advanced image scaling will be used. Can alternatively pass a number for the number of downsampling steps to take. Passing true is equivalent to passing 1.4. -
<static> setAllowedFileExtensions(fileExtensionArray)
-
Set the allowed file extensions.
Parameters:
Name Type Description fileExtensionArrayArray.<string> An array of file extensions, not case sensitive. An empty array will allow any supported file extension to be loaded. -
<static> setAsWindowsApp()
-
Flag WebViewer as running inside a Windows App so that it automatically uses the WinRTPartRetriever for loading local XOD files
-
<static> setCachingLevel(level)
-
Set the caching level, where 0 is no caching and higher numbers increase the size of the cache. The default is 10.
Parameters:
Name Type Description levelnumber The level to set -
<static> setCanvasMultiplier(value)
-
Sets the default multiplier used for rendering pages with document.loadCanvas. Higher multipliers mean that pages will be rendered at higher resolutions. The default value is the browser's devicePixelRatio
Parameters:
Name Type Description valuenumber The value of multiplier to be set -
<static> setColorManagement( [boolean])
-
Enables or color management for PDFNetJS backend. Color management is off by default. Enabling color management will better reflect correct color conversions but has a performance penalty.
Parameters:
Name Type Argument Description boolean<optional>
value if true enable color management. Otherwise disable it. -
<static> setCustomFontURL(url)
-
Set the URL at which PDFNetJS backend will request font resources for the purposes of font substitution. By default they are retrieved from the Apryse website.
Parameters:
Name Type Description urlstring The url at which font resources should be requested. -
<static> setEmscriptenHeapSize(The)
-
Adjusts the up front heap size used by Emscripten. This method must be called before the worker is initialized to change heap allocation behaviour. By default the heap size is set to 50331648 bytes. Note that decreasing the heap size very low or running complex operations may require a resize.
Parameters:
Name Type Description Thenumber number of bytes to allocate for the Emscripten heap. -
<static> setExternalPath()
-
Set the location of external scripts.
-
<static> setFontPath(path)
-
Set the path of fonts used in UI
Parameters:
Name Type Description pathstring the prefix url for font path. Example
WebViewer(...) .then(function(instance) { instance.UI.setFontPath('path/to/font'); }); -
<static> setLegacyOfficeAsmPath(workerPath)
-
Set the location of the LegacyOffice asm worker. This will override the location specified by Core.setWorkerPath for Office worker files.
Parameters:
Name Type Description workerPathstring the prefix url for WebB2XOfficeWorker.br.js.mem. -
<static> setLegacyOfficeResourcePath(workerPath)
-
Set the location of the Legacy Office resource worker. This will override the location specified by Core.setWorkerPath for Legacy Office worker files This new legacyOfficeResourcePath will be used in very specific situations where worker files are located in different locations.
Parameters:
Name Type Description workerPathstring the prefix url for WebB2XOfficeWorker.js and .mem files -
<static> setLocalWorkerPath(workerPath [, isExact])
-
Sets the location of the local worker files CORSWorker.js/CoreWorker.js which will be different when setting the main worker path to another domain. Note that this path should be on the same domain as WebViewer is being loaded.
Parameters:
Name Type Argument Description workerPathstring The path to the local worker files isExactboolean <optional>
By default this function will add a trailing slash if it wasn't added but in rare cases you may not want this behavior and can pass true for isExact -
<static> setOfficeAsmPath(workerPath)
-
Set the location of the Office asm worker. This will override the location specified by Core.setWorkerPath for Office worker files.
Parameters:
Name Type Description workerPathstring the prefix url for WebOfficeWorker.br.js.mem. -
<static> setOfficeResourcePath(workerPath)
-
Set the location of the Office resource worker. This will override the location specified by Core.setWorkerPath for Office worker files This new officeResourcePath will be used in very specific situations where worker files are located in different locations.
Parameters:
Name Type Description workerPathstring the prefix url for WebOfficeWorker.js and .mem files -
<static> setPDFAsmPath(workerPath)
-
Set the location of the PDF worker. This will override the location specified by Core.setWorkerPath for PDF worker files.
Parameters:
Name Type Description workerPathstring the prefix url for PDFNetC.gz.js. -
<static> setPDFResourcePath(resourcePath)
-
Set the location of PDF resources. This will override the location specified by Core.setWorkerPath for PDF resource files.
Parameters:
Name Type Description resourcePathstring the prefix url for PDFNetC.js.mem and PDFNet.res. -
<static> setPDFWorkerPath(workerPath)
-
Set the location of the PDF worker. This will override the location specified by Core.setWorkerPath for PDF worker files.
Parameters:
Name Type Description workerPathstring the prefix url for PDFworker.js -
<static> setPreRenderLevel(level)
-
Set the pre-render level where 0 has no pre-rendering and higher numbers have more pre-rendering. The default is 5.
Parameters:
Name Type Description levelnumber The level to set -
<static> setProgressiveTime(milliseconds)
-
Control the time between progressive events when rendering a more complex page.
Parameters:
Name Type Description millisecondsnumber the number of milliseconds between progressive events. By default this is disabled for XOD and 3 seconds (3000) otherwise. -
<static> setResourcesPath(path)
-
Sets the path to the resources folder.
Parameters:
Name Type Description pathstring Path to the resources folder relative to the HTML file -
<static> setWorkerPath(path)
-
Sets the path to the Web Worker JavaScript file. By default the file is expected to be in the same directory as the html file of the viewer and the path should be specified relative to the html file
Parameters:
Name Type Description pathstring Path to the Web Worker JS file relative to the html file of the viewer -
<static> syncNamespaces(namespaces)
-
Syncs the namespaces under the Core namespace attached to the window only.
This is required for interoperability between multiple instances of WebViewer since each loaded instance ends up with different class references despite sharing the same name.Parameters:
Name Type Description namespacesobject The object containing the namespaces that will be used. Properties
Name Type Argument Description PDFNetobject <optional>
The PDFNet namespace. This is probably the most common that needs to be synced. Actionsobject <optional>
The Actions namespace. Annotationsobject <optional>
The Annotations namespace. Mathobject <optional>
The Math namespace. Toolsobject <optional>
The Tools namespace. -
<static> unsetAsWindowsApp()
-
Unflag WebViewer as running inside a Windows App so that it doesn't automatically use the WinRTPartRetriever for loading local XOD files. This is unset by default.
-
<static> unsetCanvasMultiplier()
-
Unsets the multiplier that was set using the setCanvasMultiplier function. The multiplier will default back to the browser's devicePixelRatio
Type Definitions
-
CreateDocumentOptions
-
Create document options.
Properties:
Name Type Argument Description lstring <optional>
Same as licenseKey. licenseKeystring <optional>
The license key for viewing PDF or Office files (PDF/Office only). You only need to use one of 'l' or 'licenseKey'. docIdstring <optional>
An unique identifier for the document, used for offline mode. onLoadingProgressfunction <optional>
A callback function for loading progress, function signature function(percent) {}. onErrorfunction <optional>
A callback function that will be called when error occurs in the process of creating a document. function signature function(e) {} workerTransportPromisePromise.<any> <optional>
The workerTransportPromise that should be used to load the document. passwordstring | function <optional>
A password string or a function of the form function(callback) where callback is of the form function(password). This 'password' function will be called when a password is required to load a PDF document and should call the callback with the retrieved password. filenamestring <optional>
A filename that is used for the downloaded file, and for determining the extension when options.extension isn't used. extensionstring <optional>
Used for specifying the extension of the document to be loaded. This is necessary if the URL/path does not contain the file extension or if you're loading a Blob/File. customHeadersobject <optional>
An object containing custom HTTP headers to use when retrieving the document from the specified url. For example: {'Authorization' : 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='}. useDownloaderboolean <optional>
A boolean indicating whether Downloader should be used on urls (PDF only). https://docs.apryse.com/documentation/web/guides/usedownloader-option. withCredentialsboolean <optional>
Whether to set the withCredentials property on the XMLHttpRequest. pageSizesArray.<object> <optional>
An array of objects in the shape of { width: number, height: number }. Used to determine the page sizes when loading an image file. backendTypestring <optional>
A string representing the "backend type" for rendering PDF documents. Pass "asm" to force the use of the ASM.js worker, "ems" to force the use of the WebAssembly worker (or ASM.js on non-wasm browsers) or "wasm-threads" to use threaded WebAssembly. xodOptionsobject <optional>
An object that contains the options for a XOD document. Properties
Name Type Argument Description decryptboolean <optional>
Function to be called to decrypt a part of the XOD file. For default XOD AES encryption pass Core.Encryption.decrypt. decryptOptionsboolean <optional>
An object with options for the decryption e.g. {p: "pass", type: "aes"} where is p is the password. streamingboolean <optional>
A boolean indicating whether to use http or streaming PartRetriever, it is recommended to keep streaming false for better performance. https://docs.apryse.com/documentation/web/guides/streaming-option. azureWorkaroundboolean <optional>
Whether or not to workaround the issue of Azure not accepting range requests of a certain type. Enabling the workaround will add an extra HTTP request of overhead but will still allow documents to be loaded from other locations. startOfflineboolean <optional>
Whether to start loading the document in offline mode or not. This can be set to true if the document had previously been saved to an offline database using WebViewer APIs. You'll need to use this option to load from a completely offline state. webviewerServerURLstring <optional>
A URL to the WebViewer server drop-in backend https://docs.apryse.com/documentation/web/guides/wv-server-deployment. fallbackToClientSideboolean <optional>
A boolean indicating whether to fall back to client side rendering when WebViewer server fails cacheKeystring <optional>
A key that will be used for caching the document on WebViewer Server. forceClientSideInitboolean <optional>
If set to true then when loading a document using WebViewer Server the document will always switch to client only rendering allowing page manipulation and the full API to be used. loadAsPDFboolean <optional>
If set to true then this will convert any office file passed in into a PDF document customHandlerIdnumber <optional>
A field used to specify PDFTron custom security handler. Its value needs to be an integer in [0, 0xFFFFFFFF]. typestring <optional>
A custom document type. If set then the document type is not determined from the file extension. customDocParamsobject <optional>
An object used to pass properties down to a custom document type. isRelativePathboolean <optional>
If true, source will be considered as relative path/url. showInvalidBookmarksboolean <optional>
Default is true. If true, will retrieve invalid bookmarks shouldUseMinimumDownloadsboolean <optional>
Default is false. If true, will limit the downloading of linearized PDFs to download data needed for the current and nearby pages. officeOptionsobject <optional>
An object that contains the options for an Office document. enableOfficeEditingboolean <optional>
If true, will load office files with editing capabilities. officeOptions.templateValuesCore.TemplateData <optional>
If set, will perform template replacement with the data specified by this parameter. officeOptions.templateOptionsCore.TemplateOptions <optional>
If set, it will interpret the office document as a template document and compile all of the template tags in the document using the provided options. officeOptions.doTemplatePrepboolean <optional>
If set, it will interpret the office document as a template document and compile all of the template tags in the document. officeOptions.disableBrowserFontSubstitutionboolean <optional>
By default, office viewing takes a lightweight approach to font substitution, allowing the browser to select fonts when they are not embedded in the document itself. While this means that WebViewer has access to all the fonts on the user's system, it also means that an office document may have a different "look" on different systems (depending on the fonts available) and when it is converted to PDF (as the PDF conversion routine cannot obtain low-level access to user fonts, for security reasons). disableBrowserFontSubstitution prevents this browser substitution, forcing the WebViewer backend to handle all fonts. This means that viewing and conversion to PDF will be 100% consistent from system-to-system, at the expense of a slightly slower initial viewing time and higher bandwidth usage. Using https://docs.apryse.com/documentation/web/faq/self-serve-substitute-fonts/ along with this option allows you to fully customize the substitution behaviour for all office files. officeOptions.formatOptionsobject <optional>
An object that contains formatting options for an Office document. Same options as allowed here Core.PDFNet.Convert.OfficeToPDFOptions. Properties
Name Type Argument Description hideTotalNumberOfPagesboolean <optional>
If true will hide total number of pages from page number labels (i.e, Page 1, Page 2, vs Page 1 of 2, Page 2 of 2) applyPageBreaksToSheetboolean <optional>
If true will split Excel worksheets into pages so that the output resembles print output. displayChangeTrackingboolean <optional>
If true will display office change tracking markup present in the document (i.e, red strikethrough of deleted content and underlining of new content). Otherwise displays the resolved document content, with no markup. Defaults to true. displayHiddenTextboolean <optional>
If true will display hidden text in document. Otherwise hidden text will be not be shown. Defaults to false. displayCommentsnumber <optional>
If set to 1, it will display comment annotations in the document. Otherwise, comment annotations will not be shown. Defaults to 0 - no comments. excelDefaultCellBorderWidthnumber <optional>
Cell border width for table cells that would normally be drawn with no border. In units of points. Can be used to achieve a similar effect to the "show gridlines" display option within Microsoft Excel. excelMaxAllowedCellCountnumber <optional>
An exception will be thrown if the number of cells in an Excel document is above the value. Used for early termination of resource intensive documents. Setting this value to 250000 will allow the vast majority of Excel documents to convert without issue, while keeping RAM usage to a reasonable level. By default there is no limit to the number of allowed cells. localestring <optional>
Sets the value for Locale in the options object ISO 639-1 code of the current system locale. For example: 'en-US', 'ar-SA', 'de-DE', etc. -
LoadDocumentOptions
-
Load document options.
Properties:
Name Type Argument Default Description loadAnnotationsboolean <optional>
true Whether to load document with or without annotations. lstring <optional>
Same as licenseKey. licenseKeystring <optional>
The license key for viewing PDF or Office files (PDF/Office only). You only need to use one of 'l' or 'licenseKey'. docIdstring <optional>
An unique identifier for the document, used for offline mode. onLoadingProgressfunction <optional>
A callback function for loading progress (Only for files loaded over network), function signature: function(percent) {}. onErrorfunction <optional>
A callback function that will be called when error occurs in the process of creating a document. function signature function(e) {} workerTransportPromisePromise.<any> <optional>
The workerTransportPromise that should be used to load the document. passwordstring | function <optional>
A password string or a function of the form function(callback) where callback is of the form function(password). This 'password' function will be called when a password is required to load a PDF document and should call the callback with the retrieved password. filenamestring <optional>
A filename that is used for the downloaded file, and for determining the extension when options.extension isn't used. extensionstring <optional>
Used for specifying the extension of the document to be loaded. This is necessary if the URL/path does not contain the file extension or if you're loading a Blob/File. customHeadersobject <optional>
An object containing custom HTTP headers to use when retrieving the document from the specified url. For example: {'Authorization' : 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='}. useDownloaderboolean <optional>
A boolean indicating whether Downloader should be used on urls (PDF only). https://docs.apryse.com/documentation/web/guides/usedownloader-option/. withCredentialsboolean <optional>
Whether to set the withCredentials property on the XMLHttpRequest. pageSizesArray.<object> <optional>
An array of objects in the shape of { width: number, height: number }. Used to determine the page sizes when loading an image file. backendTypestring <optional>
A string representing the "backend type" for rendering PDF documents. Pass "asm" to force the use of the ASM.js worker, "ems" to force the use of the WebAssembly worker (or ASM.js on non-wasm browsers) or "wasm-threads" to use threaded WebAssembly. xodOptionsobject <optional>
An object that contains the options for a XOD document. Properties
Name Type Argument Description decryptboolean <optional>
Function to be called to decrypt a part of the XOD file. For default XOD AES encryption pass Core.Encryption.decrypt. decryptOptionsboolean <optional>
An object with options for the decryption e.g. {p: "pass", type: "aes"} where is p is the password. streamingboolean <optional>
A boolean indicating whether to use http or streaming PartRetriever, it is recommended to keep streaming false for better performance. https://docs.apryse.com/documentation/web/guides/streaming-option/. azureWorkaroundboolean <optional>
Whether or not to workaround the issue of Azure not accepting range requests of a certain type. Enabling the workaround will add an extra HTTP request of overhead but will still allow documents to be loaded from other locations. startOfflineboolean <optional>
Whether to start loading the document in offline mode or not. This can be set to true if the document had previously been saved to an offline database using WebViewer APIs. You'll need to use this option to load from a completely offline state. webviewerServerURLstring <optional>
A URL to the WebViewer server drop-in backend https://docs.apryse.com/documentation/web/guides/wv-server-deployment/. webviewerServerRangeRequestsboolean <optional>
If set to false then HTTP range requests will not be made to WebViewer Server. Default is true. fallbackToClientSideboolean <optional>
A boolean indicating whether to fall back to client side rendering when WebViewer server fails cacheKeystring <optional>
A key that will be used for caching the document on WebViewer Server. forceClientSideInitboolean <optional>
If set to true then when loading a document using WebViewer Server the document will always switch to client only rendering allowing page manipulation and the full API to be used. loadAsPDFboolean <optional>
If set to true then this will convert any office file passed in into a PDF document customHandlerIdnumber <optional>
A field used to specify PDFTron custom security handler. Its value needs to be an integer in [0, 0xFFFFFFFF]. typestring <optional>
A custom document type. If set then the document type is not determined from the file extension. customDocParamsobject <optional>
An object used to pass properties down to a custom document type. isRelativePathboolean <optional>
If true, source will be considered as relative path/url. showInvalidBookmarksboolean <optional>
Default is true. If true, will retrieve invalid bookmarks shouldUseMinimumDownloadsboolean <optional>
Default is false. If true, will limit the downloading of linearized PDFs to download data needed for the current and nearby pages. officeOptionsobject <optional>
An object that contains the options for an Office document. enableOfficeEditingboolean <optional>
If true, will load docx files with editing capabilities. officeOptions.templateValuesCore.TemplateData <optional>
If set, will perform template replacement with the data specified by this parameter. officeOptions.templateOptionsCore.TemplateOptions <optional>
If set, it will interpret the office document as a template document and compile all of the template tags in the document using the provided options. officeOptions.doTemplatePrepboolean <optional>
If set, it will interpret the office document as a template document and compile all of the template tags in the document. officeOptions.disableBrowserFontSubstitutionboolean <optional>
By default, office viewing takes a lightweight approach to font substitution, allowing the browser to select fonts when they are not embedded in the document itself. While this means that WebViewer has access to all the fonts on the user's system, it also means that an office document may have a different "look" on different systems (depending on the fonts available) and when it is converted to PDF (as the PDF conversion routine cannot obtain low-level access to user fonts, for security reasons). disableBrowserFontSubstitution prevents this browser substitution, forcing the WebViewer backend to handle all fonts. This means that viewing and conversion to PDF will be 100% consistent from system-to-system, at the expense of a slightly slower initial viewing time and higher bandwidth usage. Using https://docs.apryse.com/documentation/web/faq/self-serve-substitute-fonts/ along with this option allows you to fully customize the substitution behaviour for all office files. officeOptions.formatOptionsobject <optional>
An object that contains formatting options for an Office document. Same options as allowed here Core.PDFNet.Convert.OfficeToPDFOptions. Properties
Name Type Argument Description hideTotalNumberOfPagesboolean <optional>
If true will hide total number of pages from page number labels (i.e, Page 1, Page 2, vs Page 1 of 2, Page 2 of 2) applyPageBreaksToSheetboolean <optional>
If true will split Excel worksheets into pages so that the output resembles print output. displayChangeTrackingboolean <optional>
If true will display office change tracking markup present in the document (i.e, red strikethrough of deleted content and underlining of new content). Otherwise displays the resolved document content, with no markup. Defaults to true. displayHiddenTextboolean <optional>
If true will display hidden text in document. Otherwise hidden text will not be shown. Defaults to false. displayCommentsnumber <optional>
If set to 1, it will display comment annotations in the document. Otherwise, comment annotations will not be shown. Defaults to 0 - no comments. excelDefaultCellBorderWidthnumber <optional>
Cell border width for table cells that would normally be drawn with no border. In units of points. Can be used to achieve a similar effect to the "show gridlines" display option within Microsoft Excel. excelMaxAllowedCellCountnumber <optional>
An exception will be thrown if the number of cells in an Excel document is above the value. Used for early termination of resource intensive documents. Setting this value to 250000 will allow the vast majority of Excel documents to convert without issue, while keeping RAM usage to a reasonable level. By default there is no limit to the number of allowed cells. localestring <optional>
Sets the value for Locale in the options object ISO 639-1 code of the current system locale. For example: 'en-US', 'ar-SA', 'de-DE', etc. -
onDateSelected(date)
-
Callback function for when a date is selected
Parameters:
Name Type Description datestring selected Date -
TemplateBoundingBox
-
A bounding box of template tag text or template inserted content.
Type:
- object
Properties:
Name Type Description pageNumnumber The page index (1-based indexing) this bounding box appears on. boxCore.Math.Rect The bounding box, units are points. -
TemplateBoundingBoxes
-
A dictionary mapping template keys to bounding boxes of either template tags or template inserted content. The template engine tries to infer the scope of the template that are used in loops. Loop keys will be scoped in this dictionary with the '::' separator, like this:
Type:
- object.<string, Array.<Core.TemplateBoundingBox>>
- See:
-
- https://docs.apryse.com/documentation/windows/guides/generate-via-template/advanced/#explicit-loop-scope for more information on loop scoping.
Example
'loop_var_1::loop_var_2 ... ::item_var'
-
TemplateData
-
Office template data (input supplied to applyTemplateValues).
Type:
- See:
-
- https://docs.apryse.com/documentation/web/guides/generate-via-template/data-model/ for a detailed specification of the template format and supported features.
-
TemplateDataContent
-
A replacement value for a simple data tag, @example '{{tag}}'
Type:
-
TemplateDataImage
-
A bitmap image. All parameters are required. The image will be resized to the requested width and height on the page, which may change it's aspect ratio.
Properties:
Name Type Description image_urlstring URL to download image from. widthnumber The image width, measure in points. heightnumber The image height, measured in points. -
TemplateDataKeyValues
-
A dictionary of template keys and their replacement values.
Type:
- object.<string, Core.TemplateDataValue>
-
TemplateDataLoop
-
The argument to a template loop: an array which will be looped over.
Type:
- Array.<Core.TemplateDataKeyValues>
-
TemplateDataText
-
A text replacement value.
Type:
-
TemplateDataTextExplicit
-
Simple text, equivalent to just passing a string.
Properties:
Name Type Description textstring -
TemplateDataTextLines
-
An array of text which will separated by line breaks.
Properties:
Name Type Description text_linesArray.<string> -
TemplateDataValue
-
A replacement value for a tag.
Type:
-
TemplateOptions
-
Office template options.
- See:
-
- https://docs.apryse.com/documentation/web/guides/generate-via-template/data-model/ for a detailed specification of the template format and supported features.
Properties:
Name Type Argument Default Description leftDelimiterstring <optional>
'{{' The delimiter used to mark the beginning of a template tag. rightDelimiterstring <optional>
'}}' The delimiter used to mark the end of a template tag. -
TemplateSchema
-
Office template schema (output returned from getTemplateKeys with format: schema).
Type:
- object
- See:
-
- https://docs.apryse.com/documentation/web/guides/generate-via-template/data-model/ for a detailed specification of the template format and supported features.
Properties:
Name Type Description keysCore.TemplateSchemaKeyValues The top-level template keys in the document. -
TemplateSchemaBool
-
This indicates all usages of the key are used in a conditional. The key is not restricted to a boolean and can take data in the form of content such as a string, but that string would not be rendered anywhere in the document.
Type:
- object
Properties:
Name Type Description typeId'TemplateSchemaBool' docOrdernumber An index representing this template key's first occurrence in the natural flow order of the document's keys (left-to-right, top-to-bottom). -
TemplateSchemaContent
-
This indicates there is a template tag for this key that will be replaced with content, such as text or an image.
Type:
- object
Properties:
Name Type Description typeId'TemplateSchemaContent' docOrdernumber An index representing this template key's first occurrence in the natural flow order of the document's keys (left-to-right, top-to-bottom). -
TemplateSchemaKeyValues
-
A dictionary of template keys and their expected data types.
Type:
- object.<string, Core.TemplateSchemaValue>
-
TemplateSchemaLoop
-
This indicates the key is a loop. Since a key may be reused in multiple loops, the loopType property is an array.
Type:
- object
Properties:
Name Type Description typeId'TemplateSchemaLoop' docOrdernumber An index representing this template key's first occurrence in the natural flow order of the document's keys (left-to-right, top-to-bottom). itemSchemaCore.TemplateSchemaKeyValues The sub-schema for this loop. Template keys that are used within the loop will appear here. Note that if multiple loops with the same key have different inner keys, the item schema will contain the union of all inner key usages. loopTypeArray.<('tableRow'|'orderedList'|'unorderedList'|'other')> Array of the loop types, ordered by their document ordering. -
TemplateSchemaObject
-
This indicates the key is used as an object in a tag dot expression.
Type:
- object
Properties:
Name Type Description typeId'TemplateSchemaObject' docOrdernumber An index representing this template key's first occurrence in the natural flow order of the document's keys (left-to-right, top-to-bottom). propertiesCore.TemplateSchemaKeyValues The sub-schema for all properties of this object. The properties are gathered from the right-hand-side of all usages of this object in dot expressions. Example
'obj' in the tag '{{obj.prop}}' -
TemplateSchemaString
-
This indicates all usages of the key are used in a context that require a string.
Type:
- object
Properties:
Name Type Description typeId'TemplateSchemaString' docOrdernumber An index representing this template key's first occurrence in the natural flow order of the document's keys (left-to-right, top-to-bottom). -
TemplateSchemaValue
-
The expected type of input data for a template tag. The type can be read from the typeId property.
Type:
- Core.TemplateSchemaContent | Core.TemplateSchemaString | Core.TemplateSchemaBool | Core.TemplateSchemaLoop | Core.TemplateSchemaObject