AnsweredAssumed Answered

Persisting a rendition via JavaScript

Question asked by ljgp on May 4, 2015
Hi,

I read this blog post by Bas Peters about persisting renditions:

http://bpeters.tumblr.com/post/11402817096/persisting-alfresco-renditions

The aim is to have Alfresco update the rendition every time document properties are updated.

The Java call mentioned is:

renditionService.saveRenditionDefinition(compositeDefinition);

My question is: how to do this from JavaScript ? My script file currently creates a pdf rendition for ms word files on upload:

renditionDef = renditionService.createRenditionDefinition('cm:pdfRendition', 'reformat');
renditionDef.parameters["mime-type"] = "application/pdf";
renditionDef.execute(document);

But the rendition does not change after updates. Trying to call

renditionService.saveRenditionDefinition(renditionDef);

results in a typeerror: method is not defined.

Is there a way around this ? The JavaScript API is preferred because it is easier to use and easier to get through systems management (just a script and some content rules as opposed to the more heavy weight Java stuff).

Regards, Luc.

Outcomes