cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Transformations

gladiac
Champ in-the-making
Champ in-the-making
Having some problems with transforming files using a custom transformers xml file - Alfresco seems to be ignoring the custom instructions and just renaming the file.  I've checked that the command works in a terminal, no errors thrown when starting the server etc.  I've added a new filetype (png) to the transformers list for the web client and it is available to select when setting a rule up, but the end result of a transformation is a .png-named file but still in pdf format :?.

Any ideas, or places for more debugging info?

Thanks, xml below, feel free to move if this is the wrong section etc. Smiley Happy

my-transformers-context.xml

   <bean id="transformer.Pdf2Png" 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>/opt/Vividata/bin/ocrxtr -version</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="Linux">
                        <value>/opt/Vividata/bin/ocrxtr -info_log /tmp/ocrxtr.log -error_log /tmp/ocrxtr.log -out_text_format none -out_graphics_format png -out_regions_as_graphics Y -out_graphics_name "${target}" "${source}"</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.ContentTransformerRegistry$TransformationKey" >
                <constructor-arg><value>application/pdf</value></constructor-arg>
                <constructor-arg><value>image/png</value></constructor-arg>
            </bean>
         </list>
      </property>
   </bean>

web-client-config-custom.xml:

   <config evaluator="string-compare" condition="Action Wizards">
      <!– The list of transformers to show in the transform actions –>
      <transformers>
         <transformer name="image/png"/>
      </transformers>
   </config>
2 REPLIES 2

gladiac
Champ in-the-making
Champ in-the-making
Eventaully fixed it using a shell script to protect the commands from whatever Alfresco is doing to them.

Shell script called from the transformers xml file with the commandMap /opt/script.sh ${target} ${source}

newtoalf
Champ in-the-making
Champ in-the-making
Hi,

I have a custom converter written to convert CSV files into XML's. Could you please share what all configurations that I need to do like web-client.xml, etc.

I just have the converter java code written.

Thanks in advance