Document viewer
Last updated
Was this helpful?
Last updated
Was this helpful?
Document viewer can be used to present documents to the users. Document viewer supports showing documents in PDF format and most commonly used image formats.
If a format is not supported, the user will have to possibility to download the document instead.
General data is required for all portlets.
The portlet can listen to the following events:
On Row Selection
On Point Selection
The portlet data source configuration enables the portlet to execute specified queries towards the chosen database connector to fetch data, or fetch data from a workflow.
Database: uses a flow connector to retrieve data from a database
Workflow: runs a workflow to retrieve data
When fetching large PDF files, using a binary workflow for data retrieval is more efficient. This binary workflow complements the data source configuration. The document identifier (filename) is obtained through the data source query/workflow, but the data is fetched using the binary workflow.
When Binary workflow data (PDF) is configured with a workflow, this workflow will be used to fetch PDF data. To not fetch the PDF data twice the data source query/workflow should be written to leave the PDF data empty.
Note that if the data source query/workflow output contains both images and PDFs, only the data for PDFs should be left empty.
Create a binary workflow in the Studio; Machine Workflow with output set to Binary output (Stream)
Configure the binary workflow.
In the Document viewer portlet configure the data source. Make sure that the data source fetches the filename but not the data for PDF files.
Map the binary workflow in Binary Workflow Data (PDF)
Use the Binary Document Viewer to display images and enable downloads for unsupported file types, while still allowing PDFs to be handled via the Binary Workflow.
Setup Instructions:
Query/Machine Step Configuration
In your Query or Machine step, include the Data
column only if the file is not a PDF. For example:
❗ It's important to return
NULL
for theData
column when the document type is PDF.
Binary Workflow Configuration Set up a Binary Workflow that returns:
FileName
FileType
Data
Behavior:
If Data
is returned in the data source, the viewer will render images directly or display a Download button for unsupported file types.
If Data
is NULL
(e.g., for PDFs), the Binary Workflow will be triggered to load and display the PDF.
Data: optional for binary workflow
Filename: name of the file
Change the header text color and add a header stripe by configuring style.