AnsweredAssumed Answered

replace Imagemagick tiff2pdf with ocr transformer

Question asked by muristan on Jan 5, 2013
Latest reply on Jun 7, 2013 by shibasis
I have a tiff2pdf transformer using abbyyocr which is doing an excellent job under Alfresco CE 4.02

In Alfresco CE 4.2c I have this problem: After some time alfresco prefers ImageMagick to transform tiff to pdf. This is a new funktion: transformers are choosen for performance etc. In this very special case I want to disable it.

I tried to disable standard ImageMagick transformer in my transformers-context-file:


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

      <!– disable standard ImageMagick transformer –>
        <bean id="transformer.ImageMagick" class="java.lang.String"/>



   <bean id="transformer.worker.tiff2pdf" 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>/opt/ABBYYOCR9/abbyyocrwrapper.sh</value>
                                                        </list>
                                                </entry>
                                        </map>
                                </property>
                        </bean>
                </property>

                <property name="transformCommand">
                        <bean class="org.alfresco.util.exec.RuntimeExec">
                                <property name="commandsAndArguments">
                                        <map>
                                                <entry key=".*">
                                                        <list>
                                                                <value>/opt/ABBYYOCR9/abbyyocrwrapper.sh</value>

                                                                <value>-rl</value>
                                                                <value>German</value>

                                                                <value>-ic</value>
                                                                <value>ABBYYLossless</value>

                                                                <value>-ido</value>

                                                                <value>-if</value>
                                                                <value>${source}</value>

                                                                <value>-paem</value>
                                                                <value>ImageOnText</value>

                                                                <value>-pafpf</value>
                                                                <value>CCITT4</value>

                                                                <value>-pafpr</value>
                                                                <value>600</value>

                                                                <value>-pafq</value>
                                                                <value>85</value>

                                                                <value>–pdfaWriteTaggedPDF</value>

                                                                <value>-pku</value>

                                                                <value>-f</value>
                                                                <value>PDFA</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.tiff2pdf" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransformer">
                <property name="worker">
                        <ref bean="transformer.worker.tiff2pdf" />
                </property>
        </bean>

</beans>

This gives me the error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageService' defined in class path resource [alfresco/core-services-context.x
ml]: Cannot resolve reference to bean 'contentService' while setting bean property 'contentService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contentService' defined in class path resource [alfresco/content-services-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'org.alfresco.repo.content.transform.ContentTransformer' for property 'imageMagickContentTransformer'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.alfresco.repo.content.transform.ContentTransformer] for property 'imageMagickContentTransformer': no matching editors or conversion strategy found
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
        at org.alfresco.web.app.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:63)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contentService' defined in class path resource [alfresco/content-services-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'org.alfresco.repo.content.transform.ContentTransformer' for property 'imageMagickContentTransformer'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.alfresco.repo.content.transform.ContentTransformer] for property 'imageMagickContentTransformer': no matching editors or conversion strategy found
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
        … 30 more
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'org.alfresco.repo.content.transform.ContentTransformer' for property 'imageMagickContentTransformer'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.alfresco.repo.content.transform.ContentTransformer] for property 'imageMagickContentTransformer': no matching editors or conversion strategy found
        at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:462)
        at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:499)
        at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:493)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1371)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
        … 36 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.alfresco.repo.content.transform.ContentTransformer] for property 'imageMagickContentTransformer': no matching editors or conversion strategy found
        at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
        at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447)
        … 42 more

I know there is another solution: To set a limit of 0 to the Imagemagick source. Any hint how to do?
I want to disable only the tiff2pdf transformer of Imagamagick, not the others.


/opt/alfresco/tomcat/shared/classes/alfresco/extension/web-client-config-custom.xml

<config evaluator="string-compare" condition="Action Wizards">
        <transformers>
        <transformer name="image/tiff"/>
            <transformer name="message/rfc822"/>
        </transformers>
  <image-transformers>
         <transformer name="image/tiff"/>
      </image-transformers>
</config>


best regards
Andreas

Outcomes