# Namespace: Core

## Core

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

AnnotationHistoryManager
AnnotationManager
Bookmark
DisplayMode
DisplayModeManager
Document
DocumentViewer
EditBoxManager
EventHandler

### Namespaces

Actions
Annotations
Math
PartRetrievers
Search
Tools

### Members

#### <static> annotationManager

  AnnotationManager instance

  ##### Type:

  - Core.AnnotationManager
  See:
    - Core.AnnotationManager

  ##### Example

      WebViewer(...)
        .then(function(instance) {
          const annotationManager = instance.Core.annotationManager;
        });

#### <static> DisplayModes

  Display modes that control how the document's page are displayed

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `Single` | string | Displays one page at a time.
  `Continuous` | string | Displays all the pages in a scrolling view in one column.
  `Facing` | string | Displays up to two pages at a time, side by side.
  `FacingContinuous` | string | Displays all pages in a scrolling view in two columns.
  `Cover` | string | Displays all pages in a scrolling view in two columns. The first row has a single page in the second column.
  `CoverFacing` | string | Same as the Cover display mode except that it is not a scrolling view.
  `Custom` | string | Any custom display mode.

#### <static> documentViewer

  DocumentViewer instance

  ##### Type:

  - Core.DocumentViewer
  See:
    - Core.DocumentViewer

  ##### Example

      WebViewer(...)
        .then(function(instance) {
          const documentViewer = instance.Core.documentViewer;
        });

#### <static> FONT_STYLES

  Represents the font style for the watermark text

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `BOLD` | string | specifies that the text should be bolded
  `ITALIC` | string | specifies that the text should be italicized
  `UNDERLINE` | string | specifies that the text should be underlined

#### <static> MarkedStates

  Represents the different Marked state values that you can apply to annotation status.

  ##### Type:

  - string

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `Marked` | string | Marked State
  `Unmarked` | string | Unmarked State

#### <static> PageRotation

  Represents the different page rotation values that you can apply to pages.

  ##### Type:

  - number

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `E_0` | number | 0 degree rotation
  `E_90` | number | 90 degree rotation
  `E_180` | number | 180 degree rotation
  `E_270` | number | 270 degree rotation

#### <static> ReviewStates

  Represents the different review state values that you can apply to annotation status.

  ##### Type:

  - string

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `Accepted` | string | Accepted State
  `Rejected` | string | Rejected State
  `Cancelled` | string | Cancelled State
  `Completed` | string | Completed State
  `None` | string | None State

#### <static> SaveOptions

  Represents the different save option values that you can use in the getFileData function.

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `INCREMENTAL` | number | Saves new data to the end of the file
  `REMOVE_UNUSED` | number | Removes unused data when saving
  `HEX_STRINGS` | number | Save strings in hexadecimal format
  `OMIT_XREF` | number | Do not save cross reference table
  `LINEARIZED` | number | Optimize data for speed and remove unused data
  `COMPATIBILITY` | number | Maximize compatibility with older PDF consumers (e.g. the file will not use object and compressed XREF streams)

#### <static> StateModel

  Represents the different state models that you can apply to annotation.

  ##### Type:

  - string

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `Marked` | string | Marked State
  `Review` | string | Review State

#### <static> SupportedFileFormats

  Represents all the supported file formats in WebViewer

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `CLIENT` | Array.<string> | Supported file formats when using WebViewer client side rendering
  `SERVER` | Array.<string> | Supported file formats when using WebViewer with WebViewer Server

### Methods

#### <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
  --- | --- | ---
  `options` | Object | An object to set the configuration of the date picker ###### Properties
  Name | Type | Description
  --- | --- | ---
  `field` | HTMLElement | The HTML form field the date picker should be bound to
  `container` | HTMLElement | DOM node to render calendar into
  `onDateSelected` | onDateSelected | Function that is called when the date is selected from the date picker UI
  `format` | string | the date format showed after select date

#### <static> createDocument(source [, options])

  Creates an initialized Core.Document instance.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `source` | string | File | ArrayBuffer | Blob | Core.PDFNet.PDFDoc |  | Source parameter, path/url to document or File.
  `options` | object | <optional> | An object that can contain the following optional parameters. ###### Properties
  Name | Type | Argument | Description
  --- | --- | --- | ---
  `l` | string | <optional> | The license key for viewing PDF or Office files (PDF/Office only). You only need to use one of 'l' or 'licenseKey'.
  `licenseKey` | string | <optional> | The license key for viewing PDF or Office files (PDF/Office only). You only need to use one of 'l' or 'licenseKey'.
  `docId` | string | <optional> | An unique identifier for the document, used for offline mode.
  `onLoadingProgress` | function | <optional> | A callback function for loading progress, function signature function(percent) {}.
  `onError` | function | <optional> | A callback function that will be called when error occurs in the process of creating a document. function signature function(e) {}
  `workerTransportPromise` | Promise.<any> | <optional> | The workerTransportPromise that should be used to load the document.
  `password` | string | 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.
  `filename` | string | <optional> | A filename that is used for the downloaded file, and for determining the extension when options.extension isn't used.
  `extension` | string | <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.
  `customHeaders` | object | <optional> | An object containing custom HTTP headers to use when retrieving the document from the specified url. For example: {'Authorization' : 'Basic dXNlcm5hbWU6cGFzc3dvcmQ='}.
  `useDownloader` | boolean | <optional> | A boolean indicating whether Downloader should be used on urls (PDF only). https://www.pdftron.com/documentation/web/guides/usedownloader-option/.
  `withCredentials` | boolean | <optional> | Whether to set the withCredentials property on the XMLHttpRequest.
  `pageSizes` | Array.<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.
  `backendType` | string | <optional> | A string representing the "backend type" for rendering PDF documents. Pass "asm" to foce 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.
  `xodOptions` | object | <optional> | An object that contains the options for a XOD document. ###### Properties
  Name | Type | Argument | Description
  --- | --- | --- | ---
  `decrypt` | boolean | <optional> | Function to be called to decrypt a part of the XOD file. For default XOD AES encryption pass Core.Encryption.decrypt.
  `decryptOptions` | boolean | <optional> | An object with options for the decryption e.g. {p: "pass", type: "aes"} where is p is the password.
  `streaming` | boolean | <optional> | A boolean indicating whether to use http or streaming PartRetriever, it is recommended to keep streaming false for better performance. https://www.pdftron.com/documentation/web/guides/streaming-option.
  `azureWorkaround` | boolean | <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.
  `startOffline` | boolean | <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.
  `webviewerServerURL` | string | <optional> | A URL to the WebViewer server drop-in backend https://www.pdftron.com/documentation/web/guides/wv-server-deployment.
  `fallbackToClientSide` | boolean | <optional> | A boolean indicating whether to fall back to client side rendering when WebViewer server fails
  `cacheKey` | string | <optional> | A key that will be used for caching the document on WebViewer Server.
  `forceClientSideInit` | boolean | <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.
  `loadAsPDF` | boolean | <optional> | If set to true then this will convert any office file passed in into a PDF document
  `customHandlerId` | number | <optional> | A field used to specify PDFTron custom security handler. Its value needs to be an integer in [0, 0xFFFFFFFF].
  `type` | string | <optional> | A custom document type. If set then the document type is not determined from the file extension.
  `officeOptions` | object | <optional> | An object that contains the options for an Office document ###### Properties
  Name | Type | Argument | Description
  --- | --- | --- | ---
  `autoFillMap` | object | <optional> | A map of template key-value pairs
  `disableBrowserFontSubstitution` | boolean | <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://www.pdftron.com/documentation/web/faq/self-serve-substitute-fonts/ along with this option allows you to fully customize the substitution behaviour for all office files.
  `formatOptions` | object | <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
  --- | --- | --- | ---
  `applyPageBreaksToSheet` | boolean | <optional> | If true will split Excel worksheets into pages so that the output resembles print output.
  `displayChangeTracking` | boolean | <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.
  `excelDefaultCellBorderWidth` | number | <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.
  `excelMaxAllowedCellCount` | number | <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.
  `locale` | string | <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.

  ##### 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
  --- | --- | ---
  `disabled` | boolean | Whether or not to disable all WebViewer logs. Defaults to true

#### <static> enableFullPDF()

  Enable or disable use of the full version of PDFNetJS. the parameter is deprecated since version 8.0

#### <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
  --- | --- | ---
  `backendType` | string | value for default backend type, e.g. asm, ems, wasm-threads, jsworker.

#### <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> 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> getExternalPath()

  Get the location of external scripts.

  ##### Returns:

  the prefix url external scripts.
  Type
    string

#### <static> getHashParam(property, defaultValue)

  Gets the value of the specified hash parameter from the window URL

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `property` | string | The property key from hash parameter
  `defaultValue` | T | Default return value

  ##### Returns:

  A value of the hash parameter
  Type
    T

#### <static> getLocalWorkerPath()

  Get the location of the local worker files.

  ##### Returns:

  the path to CORSWorker.js/CoreWorker.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 and ResizableWorker.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
  --- | --- | ---
  `ele` | Element | 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> getWorkerPath()

  Gets the path to the Web Worker JavaScript file

  ##### Returns:

  The path to the worker
  Type
    string

#### <static> initPDFWorkerTransports(pdfBackendType, workerHandlers, l)

  Begins setup of PDF Worker Object.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `pdfBackendType` | string | object representing an PDF backend type ("asm", "ems" or "wasm-threads")
  `workerHandlers` | object | object holding event and error handlers for the worker (workerLoadingProgress, emsWorkerError).
  `l` | string | 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
  --- | --- | ---
  `type` | string | 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> 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> 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
  --- | --- | ---
  `pdfBackendType` | string | object representing a PDF backend type ("asm", "ems" or "wasm-threads")
  `workerHandlers` | object | object holding event and error handlers for the worker (workerLoadingProgress).

  ##### Returns:

  The worker object
  Type
    object

#### <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
  --- | --- | ---
  `advanced` | boolean | 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> 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 between 0 and 10, where 0 is no caching and 10 uses a very large cache. The default is 6.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `level` | number | The level to set

#### <static> setCanvasMultiplier(value)

  Sets the default multiplier used for rendering pages with document.loadCanvasAsync. Higher multipliers mean that pages will be rendered at higher resolutions. The default value is the browser's devicePixelRatio

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `value` | number | 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 pdftron website.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `url` | string | 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
  --- | --- | ---
  `The` | number | number of bytes to allocate for the Emscripten heap.

#### <static> setExternalPath()

  Set the location of external scripts.

#### <static> setIsWindowsApp(isWindowsApp)

  Sets whether WebViewer is running inside a Windows App and should automatically use the WinRTPartRetriever for loading local XOD files

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `isWindowsApp` | boolean | Whether WebViewer is running inside a Windows app or not

  Deprecated:
    - since version 8.0 Please use setAsWindowsApp or unsetAsWindowsApp instead

#### <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 | Description
  --- | --- | ---
  `workerPath` | string | The path to the local worker files
  `isExact` | boolean | 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> 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
  --- | --- | ---
  `workerPath` | string | 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
  --- | --- | ---
  `resourcePath` | string | 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
  --- | --- | ---
  `workerPath` | string | the prefix url for PDFworker.js and ResizableWorker.js

#### <static> SetPreRenderLevel(level)

  Set the pre-render level between 0 and 10, where 0 has pre-rendering and 10 has a lot of pre-rendering.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `level` | number | The level to set

#### <static> setProgressiveTime(milliseconds)

  Control the time between progressive events when rendering a more complex page.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `milliseconds` | number | 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
  --- | --- | ---
  `path` | string | 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
  --- | --- | ---
  `path` | string | 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
  --- | --- | ---
  `namespaces` | object | The object containing the namespaces that will be used. ###### Properties
  Name | Type | Argument | Description
  --- | --- | --- | ---
  `PDFNet` | object | <optional> | The PDFNet namespace. This is probably the most common that needs to be synced.
  `Actions` | object | <optional> | The Actions namespace.
  `Annotations` | object | <optional> | The Annotations namespace.
  `Math` | object | <optional> | The Math namespace.
  `Tools` | object | <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

#### Search results