cancel
Showing results for 
Search instead for 
Did you mean: 

PDF To Tiff Conversions

ncorbet
Champ in-the-making
Champ in-the-making
Hello everyone,

        This is my first time posting so please bear with me.

        I have a requirement to convert PDF's to tiffs. A large portion of these PDF's are multi-page and should produce multi-page tiffs. I have implemented what is out of the box functionality using RenditionDefintions and the rendition service.

        The problem I have is that only the first page of the PDF is transformed into a one page tiff. This happens when converting a multi-page word doc as well….but I digress. I saw in another forum post that there is an error in the code where it only grabs the first element of the multi-page document for transformation…literally coded as [0].

        Has anyone else solved this issue? I am not too sure where to start fixing it.

Thanks,

       Neil
4 REPLIES 4

ncorbet
Champ in-the-making
Champ in-the-making
So I was able to successfully create a multi-page tiff from a multi-page pdf.

Basically, the OOTB ImageMagickContentTransformerWorker has the hard coded [0] element in the source property in the transform code. (This is bad and I can't understand why this was left in)

 
        properties.put(VAR_SOURCE, sourceFile.getAbsolutePath() + "[0]");
        properties.put(VAR_TARGET, targetFile.getAbsolutePath());

In order to get the functionality I needed I had to create my own pdft2tiff-transform-context.xml. This bean definition uses the RuntimeExecutableContentTransformerWorker. It's transform function does not append the [0] to the source property:


         // add the source and target properties
        properties.put(VAR_SOURCE, sourceFile.getAbsolutePath());
        properties.put(VAR_TARGET, targetFile.getAbsolutePath());

Here is my custom pdf2tiff context file:

<beans>
   <bean id="transformer.worker.pdf2tiff"
      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="commandMap">
               <map>
                  <entry key=".*">
                     <value>${img.exe} -version</value>
                  </entry>
               </map>
            </property>
            <property name="errorCodes">
               <value>2</value>
            </property>
         </bean>
      </property>
      <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandMap">
               <map>
                  <entry key=".*">
                     <value>${img.exe} ${source} ${target}</value>
                  </entry>
               </map>
            </property>
            <property name="errorCodes">
               <value>2</value>
            </property>
         </bean>
      </property>
      <property name="explicitTransformations">
         <list>
            <bean
               class="org.alfresco.repo.content.transform.ExplictTransformationDetails">
               <property name="sourceMimetype">
                  <value>application/pdf</value>
               </property>
               <property name="targetMimetype">
                  <value>image/tiff</value>
               </property>
            </bean>
         </list>
      </property>
   </bean>
   <bean id="transformer.pdf2tiff"
      class="org.alfresco.repo.content.transform.ProxyContentTransformer"
      parent="baseContentTransformer">
      <property name="worker">
         <ref bean="transformer.worker.pdf2tiff" />
      </property>
   </bean>
</beans>

I also added a pdf2tiff-transform.properties file with the following:
# External executable locations
img.exe=${img.root}/bin/convert

I then put these files in <TOMCAT_HOME>\webapps\alfresco\WEB-INF\classes\alfresco\subsystems\thirdparty\default\   and restarted my Alfresco instance. Re-ran my code and got exactly what I wanted.

Hopefully this helps others.

ncorbet
Champ in-the-making
Champ in-the-making
Stuck again.

Apparently, this transformation only works one time. I start with a fresh repository, upload a multi-page pdf, and then run my custom transformation against it. It produces a multi-page tiff rendition. Next, I upload another multi-page pdf. I run the transformation service against it and I am back to getting the single page tiff. All subsequent multi-page pdfs that I try only transform the first page.

What gives?

Also, does any one know how to remove the Solved tag?

christopheradam
Champ in-the-making
Champ in-the-making
We know, TIFF image is regarded as the best image format for commercial work and is a standard in the printing and publishing industry. It is also a flexible raster image format for handling images and data within a single file and multiple layered images can be stored in a single TIFF file. Thus, it is quite necessary for user to convert pdf to tiff. Check out following <a href="http://www.rasteredge.com/how-to/vb-net-imaging/pdf-convert-tiff/">pdf to tiff</a> conversion methods, which is free to use:

Private Function GetPage(pageIdx As Integer) As BasePage Implements PDFDocument.GetPage
End Function
Private Function toImage() As BaseImage Implements PDFPage.toImage
End Function
Private Function toImage(height As Integer, width As Integer) As BaseImage Implements PDFPage.toImage
End Function

stephanic
Champ in-the-making
Champ in-the-making
Hi,
If you want to convert PDF file to TIFF file, then there is way by which you can convert your PDF file to TIFF format. For that you need software which can convert your PDF file to TIFF format. In my suggestion, I would suggest you to use PDF to Image Converter which is the best tool to convert PDF to TIFF format. This tool is very fast and works very efficiently. There is no need of technical skill to use this tool and will work best for you.
http://www.softwaredownloadcentre.com/software/pdf-to-image-converter.php