Skip to main content

class: com.nbx.pdfviewer.Option

Control Sample: com.nbx.pdfviewer.PDFViewerModule: com/nbx/pdfviewer/OptionApplication Component: NBX-UI5-PDFViewer
Documentation: Nubexx PDF ViewerVisibility: publicMinimum Ui5-Version required: 1.71
Extends: sap.m.PDFViewer

Overview

Contains a single key/value pair of custom configuration data for the embedded pdf.js viewer at initialization time.

Constructor

Constructor for a new Option element.

new com.nbx.pdfviewer.Option(sId?, mSettings?)

ParamTypeDefault valueDescription
sId?stringId for the new control, generated automatically if no id is given.
mSettings?objectInitial settings for the new control.

Properties

NameTypeDefault ValueDescription
keystringThe key of the configuration option. See below
valuestringThe value of the configuration option. See below

Configuration options

Options by Nubexx build of pdf.js

NameTypeDefaultDescription
allowContextMenuBooleanfalseSet to true if context menu over the viewer should be allowed.
allowOpenFromUiBooleanfalseOpen icon is shown in second toolbar & open file by STRG+ O and drag & drop is allowed.
allowOverrideProtectedApiSettingsBooleanfalseIf true, protected API-Settings be can set more than once.
Normally, properties such as showDownloadButton, showPrintButton or watermark aggregations must be assigned to the PDF control only once.
If allowOverrideProtectedApiSettings is set to true, these settings can be overwritten after the initial setting of these properties are applied.
info
This property should be set to false. This prevents a user from overwriting these properties in the browser console.
allowPresentationModeBooleanfalseIf true, then viewers presentation (full screen) mode is available.
info
This did not work in all cases, e.g. when the viewer was located in a frame element or in a WebView on iOS.
askForFileNameOnDownloadBooleanfalseIf enabled, a file dialog box is asking for filename on save / download file.
info
This feature is not Baseline because it does not work in some browsers and is only available in secure contexts (HTTPS), in some or all supporting browsers.

In unsupported browsers, the default behavior is used (askForFileNameOnDownload = false).

showToolbarBooleantrueDefines the initial visibility of the toolbar when the viewer is started.
toolbarColorSignedObject{
  light:"rgb(143,223,239)",
  dark:"rgb(0,75,115)"
}
Set toolbar background color if document is signed
toolbarShowSignedFlagBooleantrueIf set to true: Shows a button in the toolbar if the document is digitally signed.
versionPrefixStringPrefix for version info in file preferences dialog

Options by pdf.js

Default values in parentheses are changed in Nubexx build.

NameTypeDefaultDescription
annotationEditorModeNumber0 (-1)Controls the annotation editor mode.
  • DISABLE: -1
  • NONE: 0
  • FREETEXT: 3
  • HIGHLIGHT: 9
  • STAMP: 13
  • INK: 15
  • SIGNATURE: 101
annotationModeNumber1Controls which annotations are rendered.
  • DISABLE: 0 (disables all annotations)
  • ENABLE: 1 (includes all possible annotations)
  • ENABLE_FORMS: 2 (excludes annotations that contain interactive form elements, those will be rendered in the display layer)
  • ENABLE_STORAGE: 3 (includes all possible annotations - as above - but where interactive form elements are updated with data from the AnnotationStorage}-instance; useful e.g. for printing
cursorToolOnLoadNumber0The cursor tool that will be enabled on load.
  • SELECT: 0
  • HAND: 1
  • ZOOM: 2
defaultZoomValueStringempty (page-width)Default zoom level of the viewer.
  • auto
  • page-actual
  • page-width
  • page-height
  • page-fit
  • a zoom level in percent
disableAutoFetchBooleanfalseIf activated, pages are not loaded in advance. Only pages that are currently required are loaded. This may reduce data consumption for large PDFs or slow connections. If the user scrolls quickly through the document, delays may occur.
info
The server which delivered the pdf files must support range requests. Most common web servers supports this.
disableHistoryBooleanfalseDisable browsing history. The browsing history is only enabled when the viewer is standalone, i.e. not when it is embedded in a web page. See: historyUpdateUrl
disablePageLabelsBooleanfalse (true)If activated, user-defined page labels are not used in a PDF document. Some PDFs define custom page labels, such as: Roman numerals (I, II, III, ...)
disablePreferencesBooleanfalse (true)Disable console warning on manual override AppOptions
disableRangeBooleanfalseDisable range requests (not recommended). If disabled, the PDF is displayed only after the file is fully loaded.
disableStreamBooleanfalseDisable streaming for requests (not recommended).
enableAutoLinkingBooleantrue (false)Enable creation of hyperlinks from text that look like URLs.
enableHighlightFloatingButtonBooleanfalseFloating Highlight-Button direct on text select
enablePermissionsBooleanfalse(check) Enables PDF document permissions, when they exist
enablePrintAutoRotateBooleantrueWhen enabled, landscape pages are rotated when printed.
enableScriptingBooleanfalseWhether to allow execution of active content (JavaScript) by PDF files.
enableSignatureEditorBooleantrueIf enabled, the signature annotation editor is active
enableUpdatedAddImageBooleanfalseEnabled new "add image" dialog
externalLinkRelStringnoopener noreferrer nofollowSet rel attribute for external links.
  • 0: default
  • 1: replaces current window
  • 2: new window
  • 3: parent
  • 4: in top window
externalLinkTargetNumber0 (2)Controls how external links will be opened.
forcePageColorsBooleanfalseIf enabled, the pdf rendering will use the high contrast mode colors
highlightEditorColorsStringyellow=#FFFF98, green=#53FFBC, blue=#80EBFF, pink=#FFCBE6, red=#FF4F5FAvailable Colors in highlight editor
historyUpdateUrlBooleanfalseEnable historyUpdateUrl. If activated, the URL hash is updated e.g. in the page navigation like #page=2
ignoreDestinationZoomBooleanfalseIf enabled, the current zoom level is used or specified via the defaultZoomValue option instead of being taken from the PDF document.
imageResourcesPathString./images/Path for image resources, mainly for icons. Include trailing slash
localePropertiesObject{ lang: navigator.language || "en-US" }Localization to use.
pageColorsBackgroundStringCanvasThe Background color of the page as CSS color string. To improve readability in high-contrast mode.
pageColorsForegroundStringCanvasThe Foreground color of the page as CSS color string. To improve readability in high-contrast mode.
printResolutionString150Specify print resolution in dpi.
scrollModeOnLoadNumber-1 (0)Controls the viewers scroll mode upon load.
  • -1: the last position if available / enabled
  • 0: vertical scrolling
  • 1: horizontal scrolling
  • 2: wrapped scrolling
  • 3: page scrolling
sidebarViewOnLoadNumber-1 (0)Controls the state of the sidebar upon load.
  • -1: page mode if available, otherwise the last position if available / enabled
  • 0: do not show sidebar
  • 1: show thumbnails in sidebar
  • 2: show document outline in sidebar
  • 3: show attachments in sidebar
spreadModeOnLoadNumber-1 (0)Whether the viewer should join pages into spreads upon load.
  • -1: the last position if available / enabled
  • 0: no spreads
  • 1: odd spreads
  • 2: even spreads.
supportsCaretBrowsingModeBooleanfalseEnable support for caret browsing
supportsIntegratedFindBooleanfalseSet to true to enable browser search and disable PDF.js search
supportsMouseWheelZoomCtrlKeyBooleantrueIf enabled, zoom can controlled with mouse wheel + ctrl key
supportsMouseWheelZoomMetaKeyBooleantrueIf enabled, zoom can controlled with mouse wheel + meta key
supportsPinchToZoomBooleantrueEnable zooming on pinch gesture
textLayerModeNumber1Controls if the text layer is enabled, and the selection mode that is used.
  • 0: DISABLE
  • 1: ENABLE
  • 2: ENABLE_PERMISSIONS
tip
Set this to 0 to prevent copy text from pdf content.
toolbarDensityNumber0Set the toolbar density. value.
  • 0: normal
  • 1: compact
  • 2:touch
tip
Set this to 2 depending on device type such phone for better useability.
viewOnLoadNumber0 (1)The position in the document upon load.
  • -1: uses OpenAction if available, otherwise equal to viewOnLoad = 0
  • 0: the last viewed page / position
  • 1: the initial page/position.