You are here
Download Document - PNG Images
One of the most useful aspects of using SpringCM via the UI is that it allows users to view documents without having to download the entire document.
SpringCM does this by generating an image for each page of the document and then lets the user page through them. The preview images are available for download via the API which enables external applications to build their own custom document viewers. This is exposed via the DocumentDownloadPreviewImage method call.
Inputs
- token – Authentication token used in all SOAP calls
- documentId – The ID of the document who’s preview images are to be retrieved.
- start –The index of the image stream to start downloading, used in conjunction with the length parameter, images can be “chunked” out of the API
- length – length of bytes of the image to get. A negative value will attempt to send back the full size. So a start of 0 and length of -1 will try to send back the whole image without chunking. This ok for a single page, but chunking should be used for larger file downloads.
- pageNumber – the page number of the document from which to retrieve a page image. The SCMDocument object will contain the total page count, so this can be used to create paging controls for the user.
- imageZoom – This is the SCMPreviewImageZoom enumeration that states the zoom level of the image returned.
Outputs
This method returns a byte array that is an image of the page number at the zoom level for the document requested.
Not every document in SpringCM has a preview image created for it. For example, jpg files will not have a preview image associated with them, as the jpg itself can just be viewed. Documents without a preview will have a PageCount of zero on its SCMDocument object.