Reputation: 997
I created one custom web application. through that i am uploading some document to alfresco repository. i also created one PDF viewer to view document in UI.
Now the problem is, i am only able to view PDF type of document, but i am uploading different type of document in repository.
So i want a rendition copy of all documents which i uploaded in repository. i already have written CMIS code to fetch document and display in viewer.
now i just want rendition copy of document.
can any one help me with this. if possible, please provide sample source code.
Thanks in advance
Upvotes: 2
Views: 1581
Reputation: 10538
This blog post discusses Alfresco's interpretation of CMIS renditions and includes Java code that shows how to retrieve them.
To save you a click, the code from that blog post is:
OperationContext context = session.createOperationContext();
context.setRenditionFilterString("cmis:thumbnail");
CmisObject doc = session.getObjectByPath("/Sites/ren/documentLibrary/Spring Surf and OpenCMIS Integration", context);
List<Rendition> renditions = doc.getRenditions();
for (Rendition rendition : renditions)
{
System.out.println("kind: " + rendition.getKind());
System.out.println("mimetype: " + rendition.getMimeType());
System.out.println("width: " + rendition.getWidth());
System.out.println("height: " + rendition.getHeight());
System.out.println("stream id: " + rendition.getStreamId());
}
Which dumps:
kind: cmis:thumbnail
mimetype: image/png
width: 100
height: 100
stream id: workspace://SpacesStore/ef7e9a9b-c847-4023-b527-17243c72ade6
You can use that stream ID to fetch the actual rendition object and its content stream.
Upvotes: 3
Reputation: 1920
I hope I have well understood your question :
Lets admit that your alfresco is well configured and that when you go on share, your document (.doc & Cie) is rendered in the viewer.
If your document has this nodeRef :
workspace://SpacesStore/289e60a1-8b77-48da-ac53-4c2f3e81aa97
Then you can have a pdf rendering with this url :
https://localhost:8080/share/proxy/alfresco/api/node/workspace/SpacesStore/289e60a1-8b77-48da-ac53-4c2f3e81aa97/content/thumbnails/pdf?c=force
This way, you always handle pdf in your application.
Be aware that the rendering can take some time and ressource from the server.
Upvotes: 1