Class sap.m.PDFViewerModule: sap/m/PDFViewer

extends Control

This control enables you to display PDF documents within your app. It can be embedded in your user interface layout, or you can set it to open in a popup dialog.
Constructor Summary
new sap.m.PDFViewer(sId?, mSettings?)Definition of PDFViewer control Accepts an object literal mSettings that defines initial property values, aggregated and associated objects as well as event handlers.
Event Summary
error(oControlEvent)This event is fired when there is an error loading the PDF file.
loaded(oControlEvent)This event is fired when a PDF file is loaded.
sourceValidationFailed(oControlEvent)This event is fired when the PDF viewer control cannot check the loaded content.
Events borrowed from class sap.ui.core.Control
Method Summary
sap.m.PDFViewer.extend(sClassName, oClassInfo?, FNMetaImpl?)Creates a new subclass of class sap.m.PDFViewer with name sClassName and enriches it with the information contained in oClassInfo.
sap.m.PDFViewer.getMetadata()Returns a metadata object for class sap.m.PDFViewer.
addPopupButton(oPopupButton)Adds some popupButton to the aggregation popupButtons.
attachError(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the error event of this sap.m.PDFViewer.
attachLoaded(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the loaded event of this sap.m.PDFViewer.
attachSourceValidationFailed(oData?, fnFunction, oListener?)Attaches event handler fnFunction to the sourceValidationFailed event of this sap.m.PDFViewer.
destroyErrorPlaceholder()Destroys the errorPlaceholder in the aggregation errorPlaceholder.
destroyPopupButtons()Destroys all the popupButtons in the aggregation popupButtons.
detachError(fnFunction, oListener)Detaches event handler fnFunction from the error event of this sap.m.PDFViewer.
detachLoaded(fnFunction, oListener)Detaches event handler fnFunction from the loaded event of this sap.m.PDFViewer.
detachSourceValidationFailed(fnFunction, oListener)Detaches event handler fnFunction from the sourceValidationFailed event of this sap.m.PDFViewer.
downloadPDF()Downloads the PDF file.
fireError(mParameters?)Fires event error to attached listeners.
fireLoaded(mParameters?)Fires event loaded to attached listeners.
fireSourceValidationFailed(mParameters?)Fires event sourceValidationFailed to attached listeners.
getErrorPlaceholder()Gets content of aggregation errorPlaceholder.
getErrorPlaceholderMessage()Gets current value of property errorPlaceholderMessage.
getHeight()Gets current value of property height.
getPopupButtons()Gets content of aggregation popupButtons.
getShowDownloadButton()Gets current value of property showDownloadButton.
getSource()Gets current value of property source.
getTitle()Gets current value of property title.
getWidth()Gets current value of property width.
indexOfPopupButton(oPopupButton)Checks for the provided sap.m.Button in the aggregation popupButtons.
insertPopupButton(oPopupButton, iIndex)Inserts a popupButton into the aggregation popupButtons.
invalidate(oOrigin?)Triggers rerendering of this element and its children.
open()Opens the PDF viewer in a popup dialog.
removeAllPopupButtons()Removes all the controls from the aggregation popupButtons.
removePopupButton(vPopupButton)Removes a popupButton from the aggregation popupButtons.
setErrorPlaceholder(oErrorPlaceholder)Sets the aggregated errorPlaceholder.
setErrorPlaceholderMessage(sErrorPlaceholderMessage)Sets a new value for property errorPlaceholderMessage.
setHeight(sHeight)Sets a new value for property height.
setShowDownloadButton(bShowDownloadButton)Sets a new value for property showDownloadButton.
setSource(sSource)Sets a new value for property source.
setTitle(sTitle)Sets a new value for property title.
setWidth(sWidth)Sets a new value for property width.
getErrorMessage()Gets current value of property errorMessage.
getPopupHeaderTitle()Gets current value of property popupHeaderTitle.
setErrorMessage(sErrorMessage)Sets a new value for property errorMessage.
setPopupHeaderTitle(sPopupHeaderTitle)Sets a new value for property popupHeaderTitle.
Constructor Detail
new sap.m.PDFViewer(sId?, mSettings?)

Definition of PDFViewer 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 for a general description of the syntax of the settings object.

The supported settings are:

In addition, all settings applicable to the base type sap.ui.core.Control can be used as well.

Parameters:
stringsId?id for the new control, generated automatically if no id is given
objectmSettings?initial settings for the new control
Event Detail
error(oControlEvent)
This event is fired when there is an error loading the PDF file.
Parameters:
sap.ui.base.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.getParameters
loaded(oControlEvent)
This event is fired when a PDF file is loaded. If the PDF is loaded in smaller chunks, this event is fired as often as defined by the browser's plugin. This may happen after a couple chunks are processed.
Parameters:
sap.ui.base.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.getParameters
sourceValidationFailed(oControlEvent)
This event is fired when the PDF viewer control cannot check the loaded content. For example, the default configuration of the Mozilla Firefox browser may not allow checking the loaded content. This may also happen when the source PDF file is stored in a different domain. If you want no error message to be displayed when this event is fired, call the preventDefault() method inside the event handler.
Parameters:
sap.ui.base.EventoControlEvent
sap.ui.base.EventProvideroControlEvent.getSource
objectoControlEvent.getParameters
Method Detail
sap.m.PDFViewer.extend(sClassName, oClassInfo?, FNMetaImpl?): function

Creates a new subclass of class sap.m.PDFViewer with name sClassName and enriches it with the information contained in oClassInfo.

oClassInfo might contain the same kind of information as described in sap.ui.core.Control.extend.

Parameters:
stringsClassNameName of the class being created
objectoClassInfo?Object literal with information about the class
functionFNMetaImpl?Constructor function for the metadata object; if not given, it defaults to sap.ui.core.ElementMetadata
Returns:
functionCreated class / constructor function
sap.m.PDFViewer.getMetadata(): sap.ui.base.Metadata
Returns a metadata object for class sap.m.PDFViewer.
Returns:
sap.ui.base.MetadataMetadata object describing this class
addPopupButton(oPopupButton): sap.m.PDFViewer
Adds some popupButton to the aggregation popupButtons.
Parameters:
sap.m.ButtonoPopupButtonthe popupButton to add; if empty, nothing is inserted
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
attachError(oData?, fnFunction, oListener?): sap.m.PDFViewer

Attaches event handler fnFunction to the error event of this sap.m.PDFViewer.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.m.PDFViewer itself.

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

Parameters:
objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
functionfnFunctionThe function to be called when the event occurs
objectoListener?Context object to call the event handler with. Defaults to this sap.m.PDFViewer itself
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
attachLoaded(oData?, fnFunction, oListener?): sap.m.PDFViewer

Attaches event handler fnFunction to the loaded event of this sap.m.PDFViewer.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.m.PDFViewer itself.

This event is fired when a PDF file is loaded. If the PDF is loaded in smaller chunks, this event is fired as often as defined by the browser's plugin. This may happen after a couple chunks are processed.

Parameters:
objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
functionfnFunctionThe function to be called when the event occurs
objectoListener?Context object to call the event handler with. Defaults to this sap.m.PDFViewer itself
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
attachSourceValidationFailed(oData?, fnFunction, oListener?): sap.m.PDFViewer

Attaches event handler fnFunction to the sourceValidationFailed event of this sap.m.PDFViewer.

When called, the context of the event handler (its this) will be bound to oListener if specified, otherwise it will be bound to this sap.m.PDFViewer itself.

This event is fired when the PDF viewer control cannot check the loaded content. For example, the default configuration of the Mozilla Firefox browser may not allow checking the loaded content. This may also happen when the source PDF file is stored in a different domain. If you want no error message to be displayed when this event is fired, call the preventDefault() method inside the event handler.

Parameters:
objectoData?An application-specific payload object that will be passed to the event handler along with the event object when firing the event
functionfnFunctionThe function to be called when the event occurs
objectoListener?Context object to call the event handler with. Defaults to this sap.m.PDFViewer itself
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
destroyErrorPlaceholder(): sap.m.PDFViewer
Destroys the errorPlaceholder in the aggregation errorPlaceholder.
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
destroyPopupButtons(): sap.m.PDFViewer
Destroys all the popupButtons in the aggregation popupButtons.
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
detachError(fnFunction, oListener): sap.m.PDFViewer

Detaches event handler fnFunction from the error event of this sap.m.PDFViewer.

The passed function and listener object must match the ones used for event registration.

Parameters:
functionfnFunctionThe function to be called, when the event occurs
objectoListenerContext object on which the given function had to be called
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
detachLoaded(fnFunction, oListener): sap.m.PDFViewer

Detaches event handler fnFunction from the loaded event of this sap.m.PDFViewer.

The passed function and listener object must match the ones used for event registration.

Parameters:
functionfnFunctionThe function to be called, when the event occurs
objectoListenerContext object on which the given function had to be called
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
detachSourceValidationFailed(fnFunction, oListener): sap.m.PDFViewer

Detaches event handler fnFunction from the sourceValidationFailed event of this sap.m.PDFViewer.

The passed function and listener object must match the ones used for event registration.

Parameters:
functionfnFunctionThe function to be called, when the event occurs
objectoListenerContext object on which the given function had to be called
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
downloadPDF()
Downloads the PDF file.
fireError(mParameters?): sap.m.PDFViewer
Fires event error to attached listeners.
Parameters:
objectmParameters?Parameters to pass along with the event
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
fireLoaded(mParameters?): sap.m.PDFViewer
Fires event loaded to attached listeners.
Parameters:
objectmParameters?Parameters to pass along with the event
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
fireSourceValidationFailed(mParameters?): sap.m.PDFViewer
Fires event sourceValidationFailed to attached listeners.
Parameters:
objectmParameters?Parameters to pass along with the event
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
getErrorPlaceholder(): sap.ui.core.Control

Gets content of aggregation errorPlaceholder.

A custom control that can be used instead of the error message specified by the errorPlaceholderMessage property.

Returns:
sap.ui.core.Control
getErrorPlaceholderMessage(): string

Gets current value of property errorPlaceholderMessage.

A custom text that is displayed instead of the PDF file content when the PDF file cannot be loaded.

Returns:
stringValue of property errorPlaceholderMessage
getHeight(): sap.ui.core.CSSSize

Gets current value of property height.

Defines the height of the PDF viewer control, respective to the height of the parent container. Can be set to a percent, pixel, or em value.

Default value is 100%.

Returns:
sap.ui.core.CSSSizeValue of property height
getPopupButtons(): sap.m.Button[]

Gets content of aggregation popupButtons.

A multiple aggregation for buttons that can be added to the footer of the popup dialog. Works only if the PDF viewer is set to open in a popup dialog.

Returns:
sap.m.Button[]
getShowDownloadButton(): boolean

Gets current value of property showDownloadButton.

Shows or hides the download button.

Default value is true.

Returns:
booleanValue of property showDownloadButton
getSource(): sap.ui.core.URI

Gets current value of property source.

Specifies the path to the PDF file to display. Can be set to a relative or an absolute path.

Returns:
sap.ui.core.URIValue of property source
getTitle(): string

Gets current value of property title.

A custom title for the PDF viewer.

Returns:
stringValue of property title
getWidth(): sap.ui.core.CSSSize

Gets current value of property width.

Defines the width of the PDF viewer control, respective to the width of the parent container. Can be set to a percent, pixel, or em value.

Default value is 100%.

Returns:
sap.ui.core.CSSSizeValue of property width
indexOfPopupButton(oPopupButton): int
Checks for the provided sap.m.Button in the aggregation popupButtons. and returns its index if found or -1 otherwise.
Parameters:
sap.m.ButtonoPopupButtonThe popupButton whose index is looked for
Returns:
intThe index of the provided control in the aggregation if found, or -1 otherwise
insertPopupButton(oPopupButton, iIndex): sap.m.PDFViewer
Inserts a popupButton into the aggregation popupButtons.
Parameters:
sap.m.ButtonoPopupButtonthe popupButton to insert; if empty, nothing is inserted
intiIndexthe 0-based index the popupButton should be inserted at; for a negative value of iIndex, the popupButton is inserted at position 0; for a value greater than the current size of the aggregation, the popupButton is inserted at the last position
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
invalidate(oOrigin?)
Triggers rerendering of this element and its children.
Parameters:
sap.ui.base.ManagedObjectoOrigin?Child control for which the method was called
open()
Opens the PDF viewer in a popup dialog.
removeAllPopupButtons(): sap.m.Button[]

Removes all the controls from the aggregation popupButtons.

Additionally, it unregisters them from the hosting UIArea.

Returns:
sap.m.Button[]An array of the removed elements (might be empty)
removePopupButton(vPopupButton): sap.m.Button
Removes a popupButton from the aggregation popupButtons.
Parameters:
int|string|sap.m.ButtonvPopupButtonThe popupButton to remove or its index or id
Returns:
sap.m.ButtonThe removed popupButton or null
setErrorPlaceholder(oErrorPlaceholder): sap.m.PDFViewer
Sets the aggregated errorPlaceholder.
Parameters:
sap.ui.core.ControloErrorPlaceholderThe errorPlaceholder to set
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
setErrorPlaceholderMessage(sErrorPlaceholderMessage): sap.m.PDFViewer

Sets a new value for property errorPlaceholderMessage.

A custom text that is displayed instead of the PDF file content when the PDF file cannot be loaded.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
stringsErrorPlaceholderMessageNew value for property errorPlaceholderMessage
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
setHeight(sHeight): sap.m.PDFViewer

Sets a new value for property height.

Defines the height of the PDF viewer control, respective to the height of the parent container. Can be set to a percent, pixel, or em value.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 100%.

Parameters:
sap.ui.core.CSSSizesHeightNew value for property height
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
setShowDownloadButton(bShowDownloadButton): sap.m.PDFViewer

Sets a new value for property showDownloadButton.

Shows or hides the download button.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is true.

Parameters:
booleanbShowDownloadButtonNew value for property showDownloadButton
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
setSource(sSource): sap.m.PDFViewer

Sets a new value for property source.

Specifies the path to the PDF file to display. Can be set to a relative or an absolute path.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
sap.ui.core.URIsSourceNew value for property source
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
setTitle(sTitle): sap.m.PDFViewer

Sets a new value for property title.

A custom title for the PDF viewer.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
stringsTitleNew value for property title
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
setWidth(sWidth): sap.m.PDFViewer

Sets a new value for property width.

Defines the width of the PDF viewer control, respective to the width of the parent container. Can be set to a percent, pixel, or em value.

When called with a value of null or undefined, the default value of the property will be restored.

Default value is 100%.

Parameters:
sap.ui.core.CSSSizesWidthNew value for property width
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
getErrorMessage(): string

Gets current value of property errorMessage.

A custom error message that is displayed when the PDF file cannot be loaded.

Returns:
stringValue of property errorMessage
Deprecated API:
As of version 1.50.0, replaced by sap.m.PDFViewer#getErrorPlaceholderMessage().
getPopupHeaderTitle(): string

Gets current value of property popupHeaderTitle.

A custom title for the PDF viewer popup dialog. Works only if the PDF viewer is set to open in a popup dialog.

Returns:
stringValue of property popupHeaderTitle
Deprecated API:
As of version 1.50.0, replaced by sap.m.PDFViewer#getTitle().
setErrorMessage(sErrorMessage): sap.m.PDFViewer

Sets a new value for property errorMessage.

A custom error message that is displayed when the PDF file cannot be loaded.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
stringsErrorMessageNew value for property errorMessage
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
Deprecated API:
As of version 1.50.0, replaced by sap.m.PDFViewer#getErrorPlaceholderMessage().
setPopupHeaderTitle(sPopupHeaderTitle): sap.m.PDFViewer

Sets a new value for property popupHeaderTitle.

A custom title for the PDF viewer popup dialog. Works only if the PDF viewer is set to open in a popup dialog.

When called with a value of null or undefined, the default value of the property will be restored.

Parameters:
stringsPopupHeaderTitleNew value for property popupHeaderTitle
Returns:
sap.m.PDFViewerReference to this in order to allow method chaining
Deprecated API:
As of version 1.50.0, replaced by sap.m.PDFViewer#getTitle().