cancel
Showing results for 
Search instead for 
Did you mean: 

replace Imagemagick tiff2pdf with ocr transformer

muristan
Champ in-the-making
Champ in-the-making
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
4 REPLIES 4

muristan
Champ in-the-making
Champ in-the-making
Then I tried this:

in context-file /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/subsystems/thirdparty/default/imagemagick-transform-context.xml

I insert this lines:


        <property name="mimetypeLimits">
            <map>
                <entry key="image/tiff">
                        <map>
                                <entry key="application/pdf">
                                        <bean class="org.alfresco.service.cmr.repository.TransformationOptionLimits">
                                              <property name="maxSourceSizeKBytes">
                                                       <value>0</value>
                                              </proper
                                        </bean>
                                  </entry>
                        </map>
                </entry>
           </map>
        </property>



I get this error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transformer.worker.ImageMagick' defined in file [/opt/alfresco-4.2.c/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/subsystems/thirdparty/default/imagemagick-transform-context.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'mimetypeLimits' of bean class [org.alfresco.repo.content.transform.magick.ImageMagickContentTransformerWorker]: Bean property 'mimetypeLimits' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1361)
        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.alfresco.repo.management.subsystems.ChildApplicationContextFactory$ApplicationContextState.start(ChildApplicationContextFactory.java:714)
        at org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean.start(AbstractPropertyBackedBean.java:667)
        at org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean.onApplicationEvent(AbstractPropertyBackedBean.java:473)
        at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEventInternal(SafeApplicationEventMulticaster.java:209)
        at org.alfresco.repo.management.SafeApplicationEventMulticaster.multicastEvent(SafeApplicationEventMulticaster.java:180)
        at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
        at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
        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.NotWritablePropertyException: Invalid property 'mimetypeLimits' of bean class [org.alfresco.repo.content.transform.magick.ImageMagickContentTransformerWorker]: Bean property 'mimetypeLimits' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
        at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1024)
        at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:900)
        at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)
        at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1358)
        … 36 more


Well, I'm not a programmer. Any hint for me?

regards
Andreas

deajan
Champ on-the-rise
Champ on-the-rise
Hello,

I'm working on the same problem you do.
Try creating the following file /opt/alfresco/tomcat/shared/classes/alfresco/extension/web-client-config-custom.xml

containting this:

<alfresco-config>

   <!– Add the tiff mime type to the list of supported transformations –>
   <config evaluator="string-compare" condition="Action Wizards" replace="false">
      <transformers>
         <transformer name="image/tiff"/>
      </transformers>
   </config>

</alfresco-config>

Then relaunch alfresco service and try again. Does it work ?

shibasis
Champ in-the-making
Champ in-the-making
HI,
I tried similarly, but then it works for the first time after alfresco restarts,then alfresco switches the Image magick converter again.
Any Solution to this problem Please update…

magarcia_sm
Star Contributor
Star Contributor
Hi there

We are trying to achieve the same exactly with the same ocr software. It worked fine in Alfresco 3.0, but now we are trying to get this done in Alfresco 4.2 Could you please point us to a post or steps to follow in order to achieve this transformation in Alfresco 4.2?

Thanks a lot!
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.