Display and download a document
In this section, learn how to build a form for document preview and download, and display and download a document from a user task in Tasklist.
Build a form for document preview and downloading
To display and allow downloading of a document you can use the document preview component in forms.
The document preview component offers previews in forms of PDF documents and images as the most common file types. Other document types are supported, but listed without the preview and show the file name with the option to download the file.
In the component's configuration, provide a document reference as an array of document metadata.
For example, an array may look as follows:
[
{
"documentId": "u123",
"endpoint": "https://api.example.com/documents/u123",
"metadata": {
"fileName": "Document.pdf",
"contentType": "application/pdf"
}
}
]
For an example of the document reference as an array on the page for the document preview form component, review our documentation on document preview.
Display and download a document from a user task in Tasklist
A document can be displayed in a user task form in Tasklist.
When a user opens the task, they can view and download the document directly from the form.