cancel
Showing results for 
Search instead for 
Did you mean: 

Content transformation - TIFF to PDF/Word not working

shikarishambu
Champ in-the-making
Champ in-the-making
I have created rules to transform TIFF to PDF and TIFF to Word. It seems to fire and I see corresponding PDF and Word documents being created. However, these turn out to be TIFFs with PDF and Word extensions and not documents in pdf/ word format.

I noticed a post regarding a similar issue with v3.0. I am on v3.2, is this still an issue or am I missing some configuration that actually does the transformation.

And, in an attempt to force the transformation I tried downloading libtiff library and using tiff2pdf transform as outlined https://confluence.nau.edu/display/ITSACADOLE/Add+tiff+to+pdf+transformation

However, for some reason Alfresco cannot resolve the location of my exe on Windows, even though I have specified it in custom-repository.properties as shown below.

tiff2pdf.exe=D:\\apps\\Server\\GnuWin32\\bin\\tiff2pdf

My guess is it has to do with the fact that custom-repository.properties was a pre 3.2 config tool. I am not sure where to specify external exes in v3.2
TIA
8 REPLIES 8

_sax
Champ in-the-making
Champ in-the-making
With 3.2 the right point is alfresco-global.properties. In it there is a section for the external components:
#
# External locations
#————-
ooo.exe=…
img.root=…
swf.exe=…
You can add your program here.

The new file can be found at Alfresco/tomcat/shared/classes.

What issue did you discover with 3.0 - do you have a link handy?

shikarishambu
Champ in-the-making
Champ in-the-making
Thanks. I ended up putting the exes in the path (ebfore I saw your post). I am running into a different issue, actually two.

1. I can't seem to invoke the transform (TIFF > PDF) from the webclient. I setup a rule to do the TIFF to PDF transform but that still just renames TIFF as pdf. I do not see any error in the Tomcat console. Is there a way to debug?

2. I created a similar structure for OCR using tesseract but that seems to throw an error in the Tomcat console on startup. I am not sure why

My  custom-content-services-context.xml is given below
<?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.tiff2pdf"
  class="org.alfresco.repo.content.transform.ProxyContentTransformer"
  parent="baseContentTransformer">
    <property name="worker">
      <ref bean="transformer.worker.tiff2pdf" />
    </property>
  </bean>
  <bean id="transformer.worker.tiff2pdf"
  class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker">

    <property name="mimetypeService">
      <ref bean="mimetypeService" />
    </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>
    <property name="checkCommand">
      <bean class="org.alfresco.util.exec.RuntimeExec">
        <property name="commandsAndArguments">
          <map>
            <entry key=".*">
              <list>
                <value>tiff2pdf.exe</value>
                <value>-h</value>
              </list>
            </entry>
          </map>
        </property>
        <property name="errorCodes">
          <value>3</value>
        </property>
      </bean>
    </property>
    <property name="transformCommand">
      <bean class="org.alfresco.util.exec.RuntimeExec">
        <property name="commandsAndArguments">
          <map>
            <entry key=".*">
              <list>
                <value>tiff2pdf.exe</value>
                <value>${source}</value>
                <value>-o</value>
                <value>${target}</value>
              </list>
            </entry>
          </map>
        </property>
        <property name="errorCodes">
          <value>3</value>
        </property>
      </bean>
    </property>
  </bean>
  <bean id="transformer.Ocr.Tiff2Txt"
  class="org.alfresco.repo.content.transform.ProxyContentTransformer"
  parent="baseContentTransformer">
    <property name="worker">
      <ref bean="transformer.worker.Ocr.Tiff2Txt" />
    </property>
  </bean>
  <bean id="transformer.worker.Ocr.Tiff2Txt"
  class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker">
    <property name="checkCommand">
      <bean class="org.alfresco.util.exec.RuntimeExec">
        <property name="commandsAndArguments">
          <map>
            <entry key=".*">
              <value>tesseract</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="commandsAndArguments">
          <map>
            <entry key=".*">
         <list>
              <value>tesseract.exe</value>
              <value>${source}</value>
              <value>${target}</value>
           </list>
            </entry>
          </map>
        </property>
        <property name="errorCodes">
          <value>1,2</value>
        </property>
      </bean>
    </property>
   <property name="mimetypeService">
      <ref bean="mimetypeService" />
    </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>
</beans>

shikarishambu
Champ in-the-making
Champ in-the-making
I got TIFF to PDF conversion working, for the most (still get LibTiff warning on the server that someone has to hit ok).

The issue with my content-services-context.xml was tiff2pdf.exe that is part of libtiff follows this convention - exe -options <outputfile> <inputfile>
I had earlier specified exe <inputfile> -o <outputfile>

Now, I need to find a way to suppress the warnings. Cannot expect someone on the server to click through the popups.

_sax
Champ in-the-making
Champ in-the-making
I remembered that there is a problem with custom content transformer actions in 3.2:
https://issues.alfresco.com/jira/browse/ETHREEOH-2704
There is a java bean missing, or renamed.

Given, that your conversion of tiff to pdf is working, that is something you certainly worked around.
Maybe your second action throws an error related to the missing bean.

The popup problem is indeed something that is more of a LibTiff problem. What is it actually saying?
Is it something regarding syntax or the environment it is running in (-> something that can be solved)?

shikarishambu
Champ in-the-making
Champ in-the-making
The warning I get from tiff2pdf is "Invalid TIFF directory; tags are not sorted in ascending order." I did not find an option to suppress the warnings or log it rather than have a popup message. If you have ideas on how to do that please let me know

TIA

_sax
Champ in-the-making
Champ in-the-making
According to http://itu.dk/~valle/CD/BumperCowRacing/Panda3d/extlibs/libtiff/man/ps/tiff-man.ps (if not readable, it is convertable by freepdf),
there is a paragraph on page 18 which states a command that is usable with tiffcmp:
OPTIONS
−t Ignore any differences in directory tags.

Under tiff2pdf I didn't find something of this kind. Maybe you can contact the developer or use an alternative to this tool (if there is one).

nowhere
Champ in-the-making
Champ in-the-making
Hi all,
I used intelliant ocr to build my tiff to pdf tranformer as follow (file ocr-transform-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">
      <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 I would it to be shown in action when I create a rule. How could I implement this?
Can anyone help me? Smiley Happy
I'm not so expertise…thanks!

nowhere
Champ in-the-making
Champ in-the-making
I solved, thanks…Looking at code and examples, I found the way.

Anyway thanks! Smiley Happy