This page provides an introduction on how to utilize the Document Viewer widget for displaying documents.
These properties are customizable options present in the property pane of the widget, allowing users to modify the widget according to their preferences.
URL / Base64
This property allows you to include a URL or base64-encoded content to view various file formats. The supported file extensions for the widget are:
- .ppt (not supported by base64)
Additionally, you can populate the document by retrieving data from a source such as an API or Datasource Query.
JS next to the Visible property to conditionally control the widget's visibility.
JS next to the property.
docUrl property contains the URL of the uploaded document and is used to display the link to access the document.
isVisible property reflects the state of the widget's Visible setting. It is represented by a boolean value, where true indicates that the widget is visible, and false indicates that it is hidden or not displayed on the page.
Widget property setters enable you to modify the values of widget properties at runtime, eliminating the need to manually update properties in the editor.
These methods are asynchronous and return a Promise. You can use the
.then() block to ensure execution and sequencing of subsequent lines of code in Appsmith.
setVisibility (param: boolean): Promise
Sets the visibility of the widget.
setURL (param: string): Promise
Updates the URL of the document to be displayed in the Document Viewer widget.