AnsweredAssumed Answered

Content transformer for OCR ABBYY OCR4LINUX client

Question asked by deajan on Mar 12, 2015
Latest reply on Apr 23, 2015 by deajan
Hello,

I've freshly installed an Alfresco Community 5.0.c on a CentOS 7 server and tried to copy my earlier OCR integration from my Alfresco 4.2.c install.

I've created a custom content transformer in /opt/alfresco-5.0.c/tomcat/shared/classes/alfresco/extension/ocr-tiff-pdf-transformer.xml containing the following:

<?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.worker.ocrabbyy.tiff" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker">
            <property name="mimetypeService">
                <ref bean="mimetypeService" />
            </property>
              <property name="checkCommand">
                 <bean class="org.alfresco.util.exec.RuntimeExec">
                    <property name="commandsAndArguments">
                        <map>
                            <entry key=".*">
                                <list>
                                     <value>/usr/local/bin/abbyyocr9</value>
                                </list>
                            </entry>
                        </map>
                    </property>
                    <property name="errorCodes">
                       <value>2</value>
                    </property>
                 </bean>
              </property>
              <property name="transformCommand">
                 <bean class="org.alfresco.util.exec.RuntimeExec">
                    <property name="commandsAndArguments">
                        <map>
                            <entry key=".*">
                                <list>
                                    <value>/usr/local/bin/abbyyocr9</value>
                                    <value>-if</value>
                                    <value>${source}</value>
                                    <value>-pem</value>
                                    <value>ImageOnText</value>
                                    <value>-pfpf</value>
                                    <value>Automatic</value>
                                    <value>-pfpr</value>
                                    <value>300</value>
                                    <value>-f</value>
                                    <value>PDF</value>
                                    <value>-of</value>
                                    <value>${target}</value>
                                </list>
                            </entry>
                        </map>
                    </property>
                    <property name="errorCodes">
                       <value>1,2</value>
                    </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>
                 </list>
              </property>
        </bean>
        <bean id="transformer.ocr.tiff" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransformer">
            <property name="worker">
                <ref bean="transformer.worker.ocrabbyy.tiff" />
            </property>
        </bean>
</beans>


Relaunched my alfresco instance, and checked on http://mylocaltestserver:8080/alfresco/service/mimetypes?mimetype=application/pdf#application/pdf whether the transformer is registered or not.

The transformer doesn't appear.
I've enabled the following logging options in/opt/alfresco-5.0.c/tomcat/shared/classes/alfresco/extension/custom-log4j.properties and restarted the service again.


log4j.logger.org.alfresco.repo.content.transform.TransformerDebug=debug
#log4j.logger.org.alfresco.util.exec.RuntimeExecBootstrapBean=debug
log4j.logger.org.alfresco.util.exec.RuntimeExec=debug


But there isn't even a trace of that transformer in /opt/alfresco-5.0.c/alfresco.log

Anything i missed to enable custom transformers ?

Regards,
Ozy.

Outcomes