我有一个STL预览器,它可以在alfresco中使用mime类型“application / sla”预览文件。所以我想用mime类型“application / pla”渲染文件为“application / sla”。为此,我在一个包含以下脚本的文件夹上创建了一条规则
var renderingEngineName = 'reformat';
var renditionDefinitionName = 'cm:stl';
var renditionDef = renditionService.createRenditionDefinition(renditionDefinitionName, renderingEngineName);
renditionDef.parameters['mime-type'] = 'application/sla';
renditionService.render(document, renditionDef);
我还可以在管理控制台的节点浏览器中看到rendition child
但是,我仍然无法使用mime类型“application / pla”预览文件。
我还通过以下列方式定义新的spring bean来创建自定义缩略图的另一种方法
<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>
并在“web-preview.get.config.xml”中添加了以下代码以使用创建的缩略图进行预览
<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>
并且为了创建缩略图,我正在对文件夹规则执行脚本,如下所示
document.createThumbnail("stl", true);
document.save();
最后我能够获得STLViewer屏幕但是对象没有被渲染。
如果有人能帮助我,我会很棒。