Skip to main content

class: com.nbx.pdfviewer.PDFViewer

com.nbx.pdfviewer.PDFViewer extends the SAP UI5 PDFViewer. It provides all properties, events etc. from sap.m.PDFViewer.

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

Overview

This control allows you to display PDF documents on all device platforms (desktop / laptop, tablet and mobile phone) within your UI5 app. It can be embedded in your user interface layout, or you can set it to open in a popup dialog.

Constructor

Definition of Nubexx PDF Viewer control

Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers. See sap.ui.base.ManagedObject#constructor for a general description of the syntax of the settings object.

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

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

Properties

All properties from sap.m.PDFViewer.

Changed properties

NameTypeDefault ValueDescription
displayTypesap.m.PDFViewerDisplayTypeEmbeddedThis setting is ignored because the viewer is embedded on all device types.
showDownloadButtonbooleantrueShow or hide the download button in the controls toolbar and allow or disallow downloading the PDF file. 1, 2
showPrintButtonbooleantrueShow or hide the print button in the controls toolbar and allow or disallow printing the PDF file. 3
isTrustedSourcebooleanfalseThis setting is ignored.

Additional properties

NameTypeDefault ValueDescription
decryptionParamsstringDecryption params.
downloadFileNamestringSet alternative file name for download.
showToolbarcom.nbx.pdfviewer.PDFViewerShowToolbarAutoControls the visibility of the PDF viewer toolbar. 4
showWatermarkbooleanfalseShows or hides watermark defined in watermark aggregation. 5

decryptionParams 6

The Nubexx PDF Viewer can decrypt AES encrypted PDF files. The AES-Counter mode must be used for the encryption. This is useful to prevent bypass access to the PDF file, e.g. via the browser console. Especially if the current user is not allowed to save/download the PDF file or the PDF viewer generates a watermark on the PDF file to be displayed.

[!NOTE]be The AES decryption feature is currently a developer preview.

Format: <IV>:<AES-Key>

  • IV: 16 bytes initialization vector as base64 encoded string followed by a colon character
  • AES-Key: 16 or 32 bytes AES key as base64 encoded string

Alternating format: <AES-Key>

  • Alternative to the format <IV>:<AES-Key> in the decryptionParams property the string can contain a 16 or 32 bytes AES key as base64 encoded string. In this case, the delivering server must encode the IV in the first 16 bytes of the PDF stream.

[!NOTE] The IV must be unique for each PDF file delivered. Ideally, a 16-byte random value should be used here.

Aggregations

NameCardinalityTypeDescription
pdfViewerOptions0..ncom.nbx.pdfviewer.OptionOptions to initialize the build in pdf.js viewer
watermarkText0..ncom.nbx.pdfviewer.Watermark.TextText watermark objects to render over the PDF layer 5
watermarkImage0..ncom.nbx.pdfviewer.Watermark.ImageImage watermark objects to render over the PDF layer 5

Events

NameDescription
errorThis event is fired when there is an error loading the PDF file.
loadedThis event is fired when a PDF file is loaded.
initializedThis event is fired when the viewer is fully loaded and initialized, but before the loaded event is fired.

error

This event is fired when there is an error loading the PDF file.

ParameterTypeDescription
oControlEventsap.ui.base.Event
getSourcesap.ui.base.EventProvider
getParametersobject
targetanyThe iframe element.
detailsobject
messagestringThe message
reasonstringThe reason
sourceobjectThe PDF.js object

loaded

ParameterTypeDescription
oControlEventsap.ui.base.Event
getSourcesap.ui.base.EventProvider
getParametersobject
targetobjectThe PDF.js object

initialized

ParameterTypeDescription
oControlEventsap.ui.base.Event
getSourcesap.ui.base.EventProvider
getParametersobject
targetobjectThe PDF.js object

Footnotes

  1. This behavior has been changed in the Nubexx PDF Viewer. In the viewer area there is now only one download button whose visibility is controlled by showPrintButton. The redundant download icon in the control header or in the footer of the popup is not displayed anymore.

  2. The download button can not be disabled in the trial version of the PDF Viewer.

  3. The print button can not be disabled in the trial version of the PDF Viewer.

  4. The toolbar is always set to Auto in the trial version of the PDF Viewer.

  5. Watermarks are not supported in the trial version of the PDF Viewer. 2 3

  6. The decryption function is not supported in the trial trial version of the PDF Viewer.