Skip to content

API reference / Common / UDocOptions

Interface: UDocOptions ​

Options for creating a UDocBase. Every field is optional; each says its default.

Extended by ​

Properties ​

PropertyDescription
license?
string
Commercial license key. Default none: free usage, which is metered and needs the engine to reach the permit service.
hideAttribution?
boolean
Ask for the "Powered by docMentis" decal not to be painted. Honored only with a license. Default false.
disableTelemetry?
boolean
Ask for usage not to be reported. Honored only with a license. Default false.
theme?
ThemeMode
The color theme. Default "light"; UDocBase.setTheme changes it.
locale?
string
The language the chrome speaks, a BCP 47 tag such as "zh-CN": en, zh-CN, zh-TW, ja, ko, es, fr, de, pt-BR, ar or ru. Any other tag reads the pack in its language and script — zh-HK reads zh-TW, pt-PT reads pt-BR — then English. Default the browser's (navigator.language).
translations?
Partial<Messages>
Strings that replace the built-in ones, by key — the host's own wording, or a language not shipped. Default none.
showToolbar?
boolean
Show the top toolbar and the ribbon under it. Default true.
showLeftPanel?
boolean
Show the left side panel — thumbnails, outline and the other navigators. Default true.
showRightPanel?
boolean
Show the right side panel — search and comments. Default true.
showThumbnailPanel?
boolean
Show the Thumbnails panel. Default true; a document type with no such panel shows none, whatever this says — as for each panel below.
showOutlinePanel?
boolean
Show the Outline panel. Default true.
showLayersPanel?
boolean
Show the Layers panel. Default true.
showSearchPanel?
boolean
Show the Search panel. Default true.
showCommentsPanel?
boolean
Show the Comments panel. Default true.
showLoadingOverlay?
boolean
Cover the document area while a document opens — the docMentis wordmark and how far the open has got — once it has taken 300ms; the toolbar stays as it is. false is honored only with a license, as the logo is the brand. Default true.
activePanel?
PanelTab | null
The side panel open at start — not one hidden by the options above, or by its side's. Default null, none; UDocBase.openPanel and UDocBase.closePanel change it.
showThemeButton?
boolean
Show the theme button in the toolbar's menu. Default true.
showFullscreenButton?
boolean
Show the fullscreen button in the toolbar's menu. Default true.
showPrintButton?
boolean
Show the print button in the toolbar's menu. Default true.
showDownloadButton?
boolean
Show the download button in the toolbar's menu. Default true.
showDeveloperButton?
boolean
Show the developer button in the toolbar's menu — the diagnostics dialog: the performance counter, the repaint area. Default false.
enableCopy?
boolean
Let the user copy what they select to the system clipboard — Ctrl/Cmd+C and the context menu's Copy — in view mode. false leaves the selection to highlight only; edit mode copies whatever this says. Default true.
enablePointerSharing?
boolean
Share this one's pointer with the collaboration it joins: the others see it move over the pages, under its name — for presenting remotely. Default false; the people button's menu and UDocBase.setEnablePointerSharing change it.
viewControlsPlacement?
ViewControlsPlacement
Where the view controls (page nav + zoom + view settings) dock. Default "floating"; UDocBase.setViewControlsPlacement changes it.
scrollMode?
ScrollMode
How the view scrolls: "spread", one spread at a time, or "continuous". Default "continuous"; UDocBase.setScrollMode changes it.
layoutMode?
LayoutMode
How the pages group into spreads, shown side by side: "singlePage", "doublePage" (1
pageRotation?
0 | 90 | 180 | 270
The turn, in degrees clockwise, every page is shown at on top of its own — a view setting: the document is unchanged. PDF and Word documents only. Default 0; UDocBase.setPageRotation changes it.
pageGap?
PageGap
The gaps between pages, in document points — horizontal between the pages of a spread, vertical from one spread to the next. Default the built-in gaps; UDocBase.setPageGap changes it.
fit?
Fit
The fit every document opens with: its mode ("width", "height", "both" to contain, "either" to cover, "none" for the explicit zoom) and the zoomCap its zoom never passes (null for none). Default each doc type's own — fit width capped at 100% for PDF and DOCX, fit page for slides and images; UDocBase.setFit changes it.
zoom?
number
The explicit zoom every document opens at while its fit is "none" — 1 is 100%. Default 1; UDocBase.setZoom zooms the open document.
dpi?
number
CSS px per physical inch on this screen, which 100% is measured against, as the host has calibrated it — say by the user matching a ruler on screen to a real one — so 100% shows a page at its real size, a Letter page as wide as the paper beside the screen. The browser can't measure it. Default each doc type's own: 72 for a spreadsheet, whose 100% is Mac Excel's, a point drawn as a CSS px; 96, the CSS inch, for the rest. UDocBase.setDpi changes it.
zoomSteps?
readonly number[]
The zooms UDocBase.zoomIn, UDocBase.zoomOut and the zoom menu step through, ascending. Default [0.1, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4, 5].
minZoom?
number
The lowest explicit zoom — set, stepped, wheeled or pinched to. A fit goes lower when a page is too large to fit above it. Default 0.02; UDocBase.setMinZoom changes it.
maxZoom?
number
The highest explicit zoom, a marquee zoom's included — which also stops at the engine's own 16. Default 16; UDocBase.setMaxZoom changes it.
navigationScrollAlignment?
ScrollAlignment
Where a followed link or outline item, or a comment chosen in the comments panel, lands in the view: "top" (its top-left at the viewport's top-left, where a PDF destination puts it), "center", "bottom", or "nearest" (the least scroll that shows it, none when it already shows). Default "top"; UDocBase.setNavigationScrollAlignment changes it, and UDocBase.goToDestination takes one per call.
searchScrollAlignment?
ScrollAlignment
Where a search match lands when it becomes current, in the same terms. Default "nearest", so stepping through matches already in view moves nothing; UDocBase.setSearchScrollAlignment changes it, and the calls that step to a match take one per call.
onLinkClick?
(url) => void
Receives the URL of a link or outline item the user clicks, in place of its being opened — to confirm it first, say, or open it somewhere else. One that goes to a place in the document never reaches it. Default: the URL opens in a new browser tab.
fonts?
readonly (Uint8Array<ArrayBufferLike> | UrlFont)[]
Fonts of the host's own, offered to every document from the first — each a font file's bytes or a UrlFont, as UDocBase.registerFonts takes them, which adds more later. Default none.
enableGoogleFonts?
boolean
Fetch from Google Fonts the families a document names that no font of its own or the host's (UDocBase.registerFonts) covers. false offers no Google font family at all, so nothing is ever asked of Google. Default true.
googleFontFamilies?
GoogleFontFamily[]
The Google font families offered, each its name, the [bold, italic] faces Google serves for it and its subsets — to narrow the catalog @docmentis/udoc-wasm ships (GOOGLE_FONT_CATALOG), extend it or keep it current. Ignored when enableGoogleFonts is false. Default that catalog.
googleFontEndpoint?
string | URL
Where the Google Fonts css2 API is asked for a family's faces — a mirror's, for a host that can't or won't reach Google. The font files are fetched from the URLs its @font-face blocks give, so a mirror that also stands in for fonts.gstatic.com rewrites them. An absolute URL. Ignored when enableGoogleFonts is false. Default https://fonts.googleapis.com/css2.
enableCanvasFonts?
boolean
Use the fonts available to the user's browser. A family a document names that is neither registered (fonts) nor served online (Google Fonts) then renders in the copy installed on the end user's machine, which is better quality than a substitute. It depends on the device, though: the same document may render differently here than on a server or on another device. Default true.
wasm?
WasmLocateOptions
Where to load the WASM from, for a host that serves it itself. Default the copy bundled with @docmentis/udoc-wasm, then jsDelivr's.