1
votes

I have an STL previewer which can preview the file with mime type "application/sla" in alfresco. So I want to render the file with the mime type "application/pla" as "application/sla". For this, I have created a rule on a folder with the following script

var renderingEngineName = 'reformat'; var renditionDefinitionName = 'cm:stl'; var renditionDef = renditionService.createRenditionDefinition(renditionDefinitionName, renderingEngineName); renditionDef.parameters['mime-type'] = 'application/sla'; renditionService.render(document, renditionDef);

And I am also able to see rendition child in node browser of admin console

But still, I am not able to get a preview of the files with mime type "application/pla".

I also followed another approach by creating custom thumbnail by defining new spring bean in the following way

<bean id="thumbnailDefinitionSTLpreview" class="org.alfresco.repo.thumbnail.ThumbnailDefinition">
    <property name="name" value="stl" />
    <property name="mimetype" value="application/sla" />
    <property name="transformationOptions">
        <!-- The thumbnail definition have transformationOptions mandatory -->
        <!-- But there are none for pdf, so use SWFTransformationsOptions as a dummy -->
        <bean class="org.alfresco.repo.content.transform.swf.SWFTransformationOptions">
            <property name="flashVersion" value="9" />
        </bean>
    </property>
 </bean>

  <bean id="baseThumbnailRegistry" abstract="true">
    <property name="contentService" ref="ContentService"/>
    <property name="renditionService" ref="renditionService" />
    <property name="transactionService" ref="TransactionService" />
    <property name="tenantAdminService" ref="tenantAdminService" />
    <property name="redeployStaticDefsOnStartup" value="${system.thumbnail.redeployStaticDefsOnStartup}" />
    <property name="thumbnailDefinitions">
        <list>
            <ref bean="thumbnailDefinitionMedium" />
            <ref bean="thumbnailDefinitionDoclib" />
            <ref bean="thumbnailDefinitionImgpreview" />
            <ref bean="thumbnailDefinitionAvatar" />
            <ref bean="thumbnailDefinitionAvatar32" />
            <ref bean="thumbnailDefinitionPDFpreview" />
            <ref bean="thumbnailDefinitionWebpreview" />
            <ref bean="thumbnailDefinitionSTLpreview" />
        </list>
    </property>
    <property name="thumbnailRenditionConvertor" ref="thumbnailRenditionConvertor" />
 </bean>

and in "web-preview.get.config.xml" have also added following code to use created thumbnail for preview

<condition mimeType="application/sla">
      <plugin src="webpreview" paging="true">STLViewer</plugin>
      <plugin srcMaxSize="500000">Image</plugin>
</condition>

<condition thumbnail="stl">
         <plugin src="stl" paging="true">STLViewer</plugin>
</condition>

and in order to create a thumbnail, I am executing a script on a folder rule which is as follows

document.createThumbnail("stl", true);
document.save();

At the end I am able to get STLViewer screen but object is not getting rendered.

I would be great if anyone can help me with this.

1
Is application/pla an alias of sla? Or do you have some sort of pla->sla converter? - Gagravarr
application/pla is mimetype of .ply file - manav
Have you defined a transformer to convert pla to tla? - Gagravarr
yes, I have defined transformer and also I am able to see transformed thumbnail in node browser. And this generated thumbnail is also getting previewed in web preview. But I am facing problem to render this thumbnail for the preview of .ply file. - manav

1 Answers

0
votes

have you created STLViewer plugin ?? like this and you need to add the js / css dependency files to share/WEB-INF/classes/alfresco/web-extension/site-webscripts/org/alfresco/components/preview/include/web-preview-css-dependencies.lib.ftl and web-preview-js-dependencies.lib.ftl file.

For more information refer this blog