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?
Asked
Active
Viewed 1,315 times
1
-
can you please add your code too? i need inspiration for my application. – itro Apr 29 '15 at 08:40
-
sorry @itro I don't have the code anymore, it's property of my previous job – dumazy Apr 29 '15 at 18:50
1 Answers
3
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.

Jeff Potts
- 10,468
- 17
- 40