Problème (insoluble ?) pour transformer TIF ou PDF en texte

cancel
Showing results for 
Search instead for 
Did you mean: 
chaloupe
Member II

Re: Problème (insoluble ?) pour transformer TIF ou PDF en texte

CA MARCHE !!

Vous pouvez pas savoir comme je suis content  :mrgreen:
Il faut que je remercie plus particulièrement xsudan qui m'a mis sur la bonne voie. J'ai suivi son lien et suis tombé sur un fichier de config que j'ai récupéré et adapté. Je ne sais pas trop pourquoi mais, avec celui ci, ça fonctionne  :?

J'ai mis le "pas bon" dans mon second post. Voici celui qui va bien :
<?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.worker.tiff2rtf" 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>/usr/local/bin/cuneiform</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>/usr/local/bin/cuneiform</value>
                                <value>-l</value>
                                <value>fra</value>
                                <value>-f</value>
                                <value>rtf</value>
                                <value>-o</value>
                                <value>${target}</value>
                                <value>${source}</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/rtf</value></property>
                </bean>
            </list>
        </property>
    </bean>
    <bean id="transformer.worker.tiff2txt" 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>/usr/local/bin/cuneiform</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>/usr/local/bin/cuneiform</value>
                                <value>-l</value>
                                <value>fra</value>
                                <value>-f</value>
                                <value>text</value>
                                <value>-o</value>
                                <value>${target}</value>
                                <value>${source}</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>text/plain</value></property>
                </bean>
            </list>
        </property>
    </bean>
    <bean id="transformer.tiff2rtf" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransformer">
        <property name="worker">
            <ref bean="transformer.worker.tiff2rtf" />
        </property>
    </bean>
    <bean id="transformer.tiff2txt" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransformer">
        <property name="worker">
            <ref bean="transformer.worker.tiff2txt" />
        </property>
    </bean>
</beans>
Bon, ça fonctionne bien avec cuneiform, mais pas avec un script plus compliqué qui créé des fichiers temporaires (pdfocr que j'ai trouvé sur le net en l'occurrence)…c'est un début !

Voilà, si ça peut aider…