Question

I'm using Apache Chemistry OpenCMIS to access my Alfresco repository and get files. I'm able to get thumbnails via the renditions of a file (cmis:thumbnail) but it only seem to work for images. Is it possible to get thumbnail views for PDF files as well? If so, how should I do this?

Was it helpful?

Solution

Sure, it is definitely possible. The same call you use to get the renditions of an image works for office documents as well. I don't have time to whip up the Java to show you (what you're already doing will work anyway) but here is how you do it in Python, which is very similar:

>>> doc = repo.getObject("workspace://SpacesStore/5515d3e1-bb2a-42ed-833c-52802a367033")
>>> doc.name
u'Project Objectives.ppt'
>>> rends = doc.getRenditions()
>>> rends
[<cmislib.model.Rendition object at 0x1102d3210>, <cmislib.model.Rendition object at 0x1102d3990>]
>>> rends[0]
<cmislib.model.Rendition object at 0x1102d3210>
>>> rends[0].href
u'http://localhost:8080/alfresco/cmisatom/a00f3835-612c-47a0-a0ae-1e95d9a80e73/content?id=workspace%3A%2F%2FSpacesStore%2F5515d3e1-bb2a-42ed-833c-52802a367033%3B1.0&streamId=workspace%3A%2F%2FSpacesStore%2Fe725ee47-62c6-4ae9-a761-9b69ba2835c5'
>>> rends[0].title
u'doclib'
>>> rends[1].title
u'webpreview'
>>> rends[1].href
u'http://localhost:8080/alfresco/cmisatom/a00f3835-612c-47a0-a0ae-1e95d9a80e73/content?id=workspace%3A%2F%2FSpacesStore%2F5515d3e1-bb2a-42ed-833c-52802a367033%3B1.0&streamId=workspace%3A%2F%2FSpacesStore%2F41c25437-ce2e-47e1-8e3d-a2f3008e7456'
>>> rends[1].getMimeType()
u'application/x-shockwave-flash'

In this case I am retrieving the renditions of a PowerPoint file from the Sample Web Site Design Share site that comes with all installations. You can see it has two renditions. One is the doclib thumbnail that is shown in the document library list. The other is the flash file used to preview the presentation when the document details view is opened.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top