I'm using Alfresco ECM to transform TIFF to PDF using the Tiger OCR library ()
My custom transformation xml (ocr-transformers-context) is
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
<bean id="transformer.Ocr.Tiff2Pdf" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker">
<property name="checkCommand">
<bean class="org.alfresco.util.exec.RuntimeExec">
<property name="commandsAndArguments">
<map>
<entry key=".*">
<list>
<value>c:\ocr\ocr.exe</value>
<value>--about</value>
</list>
</entry>
</map>
</property>
</bean>
</property>
<property name="transformCommand">
<bean class="org.alfresco.util.exec.RuntimeExec">
<property name="commandsAndArguments">
<map>
<entry key="Windows.*">
<list>
<value>c:\ocr\ocr.exe</value>
<value>--replace</value>
<value>--replace</value>
<value>--language en</value>
<value>--pdf</value>
<value>--output-file</value>
<value>${target}</value>
<value>${source}</value>
</list>
</entry>
</map>
</property>
</bean>
</property>
<property name="explicitTransformations">
<list>
<bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
<property name="sourceMimetype"><value>image/tiff</value></property>
<property name="targetMimetype"><value>application/pdf</value></property>
</bean>
<bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
<property name="sourceMimetype"><value>image/tiff</value></property>
<property name="targetMimetype"><value>text/plain</value></property>
</bean>
</list>
</property>
</bean>
</beans>
When I import a TIFF file into the Company Home folder I now expect that content to be transformed into a PDF. Now am I right in assuming that the transformation is automatic or do I need to invoke a rule on the space ?
Also, I have set the loggin开发者_开发技巧g on the transformation to DEBUG and this is what I see in Alfresco logs
DEBUG [util.exec.RuntimeExec] Execution result: os:
Windows XP command: [c:\ocr\ocr.exe, --about] succeeded: true exit code: 0 out: Intelliant OCR commandline utility, version 1.1.0. Copyright © 2006.Credits:
TIFF Library Copyright (c) 1988-1997 Sam Leffler Copyright (c) 1991-1997 Silicon Graphics, Inc.
Independent JPEG Group Library
Copyright (C) 1991-19 User:admin DEBUG [content.transform.ContentTransformerRegistry] Searched for transformer: source mimetype: image/tiff target mimetype: text/plain transformers: []
Seems like its searching for a target of text/plain when I really need it to transform to PDF. What am I missing here ? Pls help
The only transform that'll be run automatically is the one to text plain, which is used for the full text indexing.
If you're using Share, then Share will try to do two more transformations for you. Firstly, it'll try to generate a thumbnail (via the rendition service) when you view the folder with your file in it. For this to work, you'd normally define a transformer from your new mime type to image/jpeg. Additionally, when you view the document details in Share, it'll try to give you a web preview.
If you'd like to have a PDF version of your document generated when you upload it, then you'll want to define a rule. You could do this with a transform content rule, or you could write a script to use the Rendition Service if you wanted a lot of control over it.
精彩评论