Reformat rendering engine

cancel
Showing results for 
Search instead for 
Did you mean: 

Reformat rendering engine

resplin
Intermediate
0 0 1,335

Obsolete Pages{{Obsolete}}

The official documentation is at: http://docs.alfresco.com



3.3


Overview


The Reformat rendering engine is designed to support the creation of renditions of content nodes in different MIME types. It was introduced in version 3.3 as one of the first rendering engines available to the core rendition service. This rendering engine has a name of 'reformat' and is represented by the class org.alfresco.repo.rendition.executer.ReformatRenderingEngine.


3.3


Design


Like all rendering engines, the Reformat Rendering Engine generates one rendition node from a given source node. Based on the MIME type of the source node and the MIME type requested for the rendition node, Alfresco will attempt to locate the most appropriate transformer. This rendering engine only requires a single parameter:


  •   PARAM_MIME_TYPE: (String) this mandatory parameter (see AbstractRenderingEngine.PARAM_MIME_TYPE) is the MIME type required for the rendition node.

The actual transformation from source to target MIME type is provided by the Content Transformers in Alfresco's ContentService. There is therefore support for various transformation paths and this service can be extended to provide additional transformers in the usual way. Obviously there will be MIME type pairs for which a transformation is not available and for which the Reformat Rendering Engine cannot produce a rendition.


JavaScript invocation


JavaScript invocation of the reformat rendering engine is easy as the following code example displays:


var file = ...; /* Get file as scriptNode as you normally would */

var renditionDef = renditionService.createRenditionDefinition('cm:pdfExport', 'reformat');
renditionDef.parameters['mime-type'] = 'application/pdf';

var pdfFile = renditionService.render(file, renditionDef);

This will create a (temporary, not persisted) rendition definition that can be used to create a PDF rendition of the original file.