File preview
The File Preview component enables preview of files such as .pdf, .docx, .pptx, etc., in the Web User Interface. It is possible to preview files in the File Module and files associated with a DigitalFile (managed files). File previewing for SoftTypes requires the use of the file preview control in the read view configuration.
How it works
If a selected file is an image file, no preview file is created. For other file types a preview image file is created by the Preview File component and stored in a preview container. The preview file is created the first time a file is selected for preview. Following previews will use the previously rendered preview files, i.e. the preview files are cached.
A file preview request scenario would look like this:
Is the selected file an image file type? If yes then return status code 200 Ok
together with
a payload with a link to the file. If not an image file then check if there already is a preview
for the file in the preview container? If a preview can be found then return status code 200 Ok
together with a payload with links to the preview file. If no preview is found then check if
creation of a preview image is currently in progress? If it is in progress then return status code
202 Accepted
along with a payload saying InProgress
. If it is not in progress then check if there
is support for creating previews of the given file (check if there are any extensions registered in ShareAspace
with the capability HandleMimeType
that has the current MIME type in its capabilities list).
If the current MIME type is not supported then return status code 202 No Content
. If the current
MIME type is supported then call the registered File Preview extension and return status code
202 Accepted
together with a response payload saying the preview creation is started (i.e. InProgress
).
The file will be marked as being InProgress
if previews are requested for the file before they are
completed. At this point there is no way of knowing if preview creation is working or not, since
the extension only responds that the request has been received. This means that a file can be marked
as InProgress
for the rest of time. If the preview file is finally created it will be uploaded back
to ShareAspace from the extension service and the file will no longer be marked as InProgress
.
Supported file types
All image files and the following file types are supported:
File | Extension |
---|---|
.doc |
|
.docx |
|
.ppt |
|
.pptx |
|
.pdf |
|
.rtf |
|
.odp |
|
.odt |