cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] Content Transformation

nowhere
Champ in-the-making
Champ in-the-making
Hi all,
I'm trying to implement a transformer to use intelliant OCR.
Following example at this url http://wiki.alfresco.com/wiki/Content_Transformations#RuntimeExecutableContentTransformer
I wrote my ocr-tranformer-context.xml

<?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" parent="baseContentTransformer">
      <property name="checkCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
                <map>
                    <entry key=".*">
                        <value>ocr.exe –about</value>
                    </entry>
                </map>
            </property>
         
         </bean>
      </property>
      <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
                <map>
                    <entry key="Windows.*">
                        <value>ocr.exe –replace –language fr –pdf –output-file "${target}" "${source}"</value>
                    </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>
         </list>
      </property>
   </bean>   
</beans>

and I get following error at tomcat startup:

ERROR [web.context.ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'transformer.Ocr.Tiff2Pdf' defined in file [C:\Tomcat6\shared\classes\alf
resco\extension\ocr-transformers-context.xml]: Error setting property values; ne
sted exception is org.springframework.beans.NotWritablePropertyException: Invali
d property 'registry' of bean class [org.alfresco.repo.content.transform.Runtime
ExecutableContentTransformerWorker]: Bean property 'registry' is not writable or
has an invalid setter method. Does the parameter type of the setter match the r
eturn type of the getter?

Where am I in wrong? Hoping in some help, it's very urgent to me Smiley Happy

Thanks!
4 REPLIES 4

nowhere
Champ in-the-making
Champ in-the-making
I solved doing so:

<?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="commandMap">
                <map>
                    <entry key=".*">
                        <value>ocr.exe –about</value>
                    </entry>
                </map>
            </property>
         
         </bean>
      </property>
      <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
                <map>
                    <entry key="Windows.*">
                        <value>ocr.exe –replace –language fr –pdf –output-file "${target}" "${source}"</value>
                    </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>
         </list>
      </property>
   </bean>

   <bean id="transformer.ocrTopdf" class="org.alfresco.repo.content.transform.ProxyContentTransformer"
      parent="baseContentTransformer">
      <property name="worker">
         <ref bean="transformer.Ocr.Tiff2Pdf"/>
      </property>
   </bean>
</beans>

But now I can't how make this transformation available among rules action. Ca anyone address me to a guide or give some hint?
Thanks!

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
This leads to a problem I call You have a gun but no ammo.
My idea is to develop action to convert any image not just tiff to pdf (with ocr). ocr is working great!

savic_prvoslav
Champ on-the-rise
Champ on-the-rise
Has anyone has been successful to work Intelliant OCR on linux with wine?

wmay
Champ in-the-making
Champ in-the-making
Hi,

We have implemented an OCR server integrated with Alfresco, which can be used as transformer or via Javascript and Java. It runs on  a separate OCR server and supports Abbyy and Google OCR. for more informaiton see here - https://forums.alfresco.com/en/viewtopic.php?f=33&t=44739