cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco CE 3.0 transformer not launching

magarcia_sm
Star Contributor
Star Contributor

Hello all

     We are creating a tiff to pdf transformation with tesseract 3.03 in our alfresco community version 3.0. We have created an configuration file ocr-transformers-context.xml with the following code

<?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.tiff2pdfTess" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransformer">

        <property name="worker">

            <ref bean="transformer.worker.tiff2pdfTess" />

        </property>

    </bean>

    <bean id="transformer.worker.tiff2pdfTess" 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>chmod 755 /opt/ocr/transformRotateOCRMulti.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/ocr/transformRotateOCRMulti.sh ${source} ${target}</value>

                            </list>

                        </entry>

                    </map>

                </property>

                <property name="errorCodes">

                    <value>1,2,3</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>

</beans>

The sh script is a bash script that receibes a Tiff image and runs tesseract to tranform it to a PDF file. If we execute the command it works fine with not issue. This script has 777 permission

Problem is that when we launch alfresco and we want to run a rule so every time a new TIFF file gets included in a space it gets transformed to PDF... nothing happens. We have placed the file in

$AlfrescoHome/tomcat/shared/classes/alfresco/extension/.. and we know the ocr-transformers-context.sml file gets loaded because if we introduce wrong code in it, alfresco is not able to be launched. However seems to us that Alfresco is never using this transformation like if he is not able or we have not configured it, to use the bash sh linux script.

We have tried to move the ocr-transformers-context.xml file from $AlfrescoHome/tomcat/shared/classes/alfresco/extension/ to $AlfrescoHome/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/extension/.. but again no transformation is run.

What else we must do to get this transformation executed?

I can tell you also that nothing is shown in the alfresco.log file. Also the bash sh script has a log file that never gets created.

Any ideas please?

7 REPLIES 7

kaynezhang
World-Class Innovator
World-Class Innovator

Dose your linux user that you run alfresco on has the permission to execute chmod 755 /opt/ocr/transformRotateOCRMulti.sh

If we execute only /opt/ocr/transformRotateOCRMulti.sh we have the same problem.

kaynezhang
World-Class Innovator
World-Class Innovator

1.If you have place ocr-transformers-context.xml under classpath:/alfresco/extension/ ,it will be correctly loaded.

2.If you execute only /opt/ocr/transformRotateOCRMulti.sh,it still dose not work ,it means this problem was not caused by error check command (It came to my mind first that your linux user dose not have permission to execute chmod 755 /opt/ocr/transformRotateOCRMulti.sh command which lead to alfresco set

this transformer to be unusable, and the  transformer will not be called at all).

3.Maybe because you define the transformer using an deprecated way ,which lead to it has an low priority .The low priority cause it dose not have opportunity to be called.

Hi thanks a lot for the answer

we have placed the ocr-transformer-context.xml file in %alf_home/tomcat/shared/classes/alfresco/extension and also %alf_home/tomcat/weapps/alfresco/WEB-INF/classes/alfresco/extension, but we are not able to get it to call the transformation.

What you mean about the low priority could be an option, but how can we increase the priorito of our transformation?. What we thought is that the system is running the ImageMagic tiff/PDF transformation that comes by deault, but we are not able to check in Alfresco 3.0 which transformer is linked to TIFF and we do not know how to decrease the priority of the ImagineMagick tiff/pdf transformation and increase the priority of our one. We have checked the documentation for Alfresco 4.2 and Alfresco 5.0 and it is shown how to do it in global-properties, but How can it be donw in Alfresco 3.0?

Thanks

kaynezhang
World-Class Innovator
World-Class Innovator

In alfresco 5(maybe in your version too) it is not recommended to use class org.alfresco.repo.content.transform.ExplictTransformationDetails to configure supported transformations. And the bean configured use this class will be given an low priority. It is commended to configure supported transformation in alfresco-global.properties like this:

content.transformer.ImageMagick.extensions.png.png.priority=50

content.transformer.ImageMagick.extensions.pdf.png.priority=50

content.transformer.ImageMagick.extensions.ai.png.priority=50

content.transformer.double.ImageMagick.available=false

you can refer to https://github.com/bchevallereau/alfresco-tesseract/ to see if it can be used in your version directly.

mitpatoliya
Star Collaborator
Star Collaborator

Hi magarcia_sm _kayne zhang​ has correctly pointed out main reason in his last post.

4.2.d onwards the explicitTransformation property is no longer used, so we must define the transformation related repository properties in addition to the Spring configuration.

Here is the blog where you could find more details about this.

Changes to Transformers configuration in Alfresco 4.2 | Will Abson on Alfresco

And see the example given in alfresco docs

Content Transformers (and Renditions) | Alfresco Documentation

Thank you very much for the answers

We were working with Alfresco 3.0. Now we have decided to migrate to Alfresco 4.2 and we have managed to configure it without problem.

Thanks and regards