Document viewer

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

General data is required for all portlets.

General configuration

Listeners

The portlet can listen to the following events:

  • On Row Selection

  • On Point Selection

Listeners configuration

Data

Data source

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

Data source configuration

Workflow source configuration

Binary workflow

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.

Example set-up

  1. Create a binary workflow in the Studio; Machine Workflow with output set to Binary output (Stream)

  2. Configure the binary workflow.

  3. 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.

  4. Map the binary workflow in Binary Workflow Data (PDF)

Set up example with mixed output

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:

  1. Query/Machine Step Configuration In your Query or Machine step, include the Data column only if the file is not a PDF. For example:

    SELECT
      DocumentMgmtId,
      DocumentMgmtType,
      FileName,
      IIF(DocumentMgmtType <> 'pdf', Data, NULL) AS Data
    FROM DocumentMgmt
    WHERE FileName = {filename}

    ❗ It's important to return NULL for the Data column when the document type is PDF.

  2. 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.

Presentation

Data: optional for binary workflow

Filename: name of the file

Style

Change the header text color and add a header stripe by configuring style.

Style configuration

Last updated

Was this helpful?