AnsweredAssumed Answered

Create new transformation in Alfresco 4.2

Question asked by magarcia_sm on Jun 22, 2015
Hi there

I am trying to move a transformation code I have in Alfresco 3 to Alfresco 4.2. I am trying to follow the instructions in the document, but would be great if I can find a couple of examples of these configuration files to compare whith what I have.

I have this xml file(Alfresco 3)  to run the transformation of TIFF and JPEG files using ABBYY OCR to PDF:


<?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.RuntimeExecutableContentTransformer" parent="baseContentTransformer">
      <property name="checkCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
               <map>
                  <entry key=".*">
                     <value>abbyyocr9</value>
                  </entry>
               </map>
            </property>
            <property name="errorCodes">
               <value>1,2</value>
            </property>
         </bean>
      </property>
      <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
               <map>
                  <entry key=".*">
                     <value>
                        abbyyocr9 -rl Spanish -fm -rdss -afoe -if ${source} -f PDF -pfpf LZWGray -pem ImageOnText -pfpr 300 -prl -of ${target}
                     </value>
                  </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>
<!–
            <bean class="org.alfresco.repo.content.transform.ContentTransformerRegistry$TransformationKey">
               <constructor-arg>
                  <value>image/tiff</value>
               </constructor-arg>
               <constructor-arg>
                  <value>application/pdf</value>
               </constructor-arg>
            </bean>
            –>
         </list>
      </property>
   </bean>
   
   <bean id="transformer.Ocr.Jpg2Pdf" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformer" parent="baseContentTransformer">
      <property name="checkCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
               <map>
                  <entry key=".*">
                     <value>abbyyocr9</value>
                  </entry>
               </map>
            </property>
            <property name="errorCodes">
               <value>1,2</value>
            </property>
         </bean>
      </property>
      <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
               <map>
                  <entry key=".*">
                     <value>
                        abbyyocr9 -if ${source} -f PDF -pfpf JpegColor -pem ImageOnText -pfpr 200 -pfq 100 -prl -of ${target}
                     </value>
                  </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/jpeg</value></property>
               <property name="targetMimetype"><value>application/pdf</value></property>
            </bean>
            <!–
            <bean class="org.alfresco.repo.content.transform.ContentTransformerRegistry$TransformationKey">
               <constructor-arg>
                  <value>image/tiff</value>
               </constructor-arg>
               <constructor-arg>
                  <value>application/rtf</value>
               </constructor-arg>
            </bean>
            –>
         </list>
      </property>
   </bean>
</beans>


Could you please point me an example of how I should move this to the new Alfresco 4.2 Transformation Definition??

Cheers!!

Outcomes