AnsweredAssumed Answered

DWG to PDF Transformation

Question asked by tsafarog on Aug 7, 2014
Latest reply on Jan 28, 2015 by wayzz1992
Hello i am trying to get previews of DWG files (autocad drawings) into my alfresco share

I first tried with Irfanview but changed application because for some reason in the checkcommand i couldnt get the dwg to convert in pdf. So i changed applications with AcmeCadconverter which works just fine in the checkcommand

So now my tranformer looks like this:


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>

<!– TRASFORMA DWG IN PDF   –>
<bean id="transformer.worker.dwg2pdf" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker">
        <property name="mimetypeService">
         <ref bean="mimetypeService" />
      </property>
      <property name="checkCommand">
         <bean name="transformer.dwg2pdf.checkCommand" class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandsAndArguments">
                <map>
                    <entry key=".*">
                  <list>
                   <value>cmd</value>
                        <value>/C</value>
                  <value>${dwg2pdf.root}/AcmeCADConverter.exe /r /ad /f 104 E:\ECM\bin\acme\dtp.dwg dtp.pdf</value>
                  </list>
               </entry>
                </map>
            </property>
         </bean>
        </property>
         <property name="transformCommand">
         <bean name="transformer.dwg2pdf.Command" class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandsAndArguments">
               <map>
                  <entry key="Linux.*">
                  <list>
                   <value>sh</value>
                        <value>-c</value>
                    <value>${dwg2pdf.root}/AcmeCADConverter /r /ad /f 104 ${source} ${target}</value>
                  </list>
                  </entry>
                  <entry key="Windows.*">
                  <list>
                  <value>cmd</value>
                        <value>/C</value>
                  <value>${dwg2pdf.root}/AcmeCADConverter.exe /r /ad /f 104 ${source} ${target}</value>
                    </list>
                  </entry>
                    </map>
            </property>
         <property name="waitForCompletion">
                <value>true</value>
            </property>
         </bean>
      </property>
      <property name="explicitTransformations">
         <list>
            <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
                <property name="sourceMimetype"><value>image/vnd.dwg</value></property>
            <property name="targetMimetype"><value>application/pdf</value></property>
            </bean>
         </list>
      </property>
   </bean>
  
   <bean id="transformer.proxy.dwg2pdf" class="org.alfresco.repo.management.subsystems.SubsystemProxyFactory">
    <property name="sourceApplicationContextFactory">
      <ref bean="thirdparty"/>
    </property>
    <property name="sourceBeanName">
      <value>transformer.worker.dwg2pdf</value>
    </property>
    <property name="interfaces">
      <list>
        <value>org.alfresco.repo.content.transform.ContentTransformerWorker</value>
      </list>
    </property>
  </bean>
 
   <bean id="transformer.dwg2pdf" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransformer">
      <property name="worker">
         <ref bean="transformer.worker.dwg2pdf" />
      </property>
   </bean>

</beans>


I also updated global.properties file as following


### External executable locations ###
ooo.exe=E:\\ECM\\libreoffice\\App\\libreoffice\\program\\soffice.exe
ooo.enabled=true
ooo.port=8100
img.root=E:\\ECM\\imagemagick
img.coders=${img.root}\\modules\\coders
img.config=${img.root}\\config
img.gslib=${img.root}\\lib
img.exe=${img.root}\\convert.exe
swf.exe=E:\\ECM\\swftools\\pdf2swf.exe
swf.languagedir=E:\\ECM\\swftools\\japanese
dwg2pdf.root=E:\\ECM\\bin\\acme
img.gslib=E:\\ECM\\bin\\gs9.09\\lib

jodconverter.enabled=true
jodconverter.officeHome=E:\\ECM\\libreoffice\\App\\libreoffice
jodconverter.portNumbers=8100

# What follows are the custom transforms
# Imput dwg the output is PDF
# Define a default priority for the transformer
content.transformer.dwg2pdf.priority=50
# List the transformations that are supported
content.transformer.dwg2pdf.extensions.dwg.pdf.supported=true
content.transformer.dwg2pdf.extensions.dwg.pdf.priority=50


THIS LOG OUTPUT


11:41:45,596 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-5] 6             dwg  txt  GRAMMIKO KIATO RIO_new2.dwg 288.4 KB – index – SolrIndexer NO transformers
11:41:45,596 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-5] 6             Finished in 0 ms Transformer NOT called

11:41:45,690 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-9] 7             dwg  txt  GRAMMIKO KIATO RIO_new2.dwg 288.4 KB – index – SolrIndexer NO transformers
11:41:45,690 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-9] 7             Finished in 0 ms Transformer NOT called

11:41:53,672 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [pool-17-thread-1] 8             dwg  pdf  GRAMMIKO KIATO RIO_new2.dwg 288.4 KB – pdf – ContentService.transform(…)
11:41:53,672 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [pool-17-thread-1] 8             **a)  [50] dwg2pdf<<Runtime>>           0 ms
11:41:53,672 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [pool-17-thread-1] 8.1           dwg  pdf  GRAMMIKO KIATO RIO_new2.dwg 288.4 KB dwg2pdf<<Runtime>>
11:42:06,938 DEBUG [org.alfresco.util.exec.RuntimeExec] [pool-17-thread-1] Execution result:
   os:         Windows Server 2012
   command:    cmd /C "E:\\ECM\\bin\\acme\\AcmeCADConverter.exe /r /ad /f 104 "E:\ECM\tomcat\temp\Alfresco\RuntimeExecutableContentTransformerWorker_source_1366542181829387142.dwg" "E:\ECM\tomcat\temp\Alfresco\RuntimeExecutableContentTransformerWorker_target_1118018117675185787.pdf""
   succeeded:  true
   exit code:  0
   out:       
   err:       
11:42:06,953 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [pool-17-thread-1] 8             Finished in 13.281 ms

11:42:15,485 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-8] 9             dwg  txt  GRAMMIKO KIATO RIO_new2.dwg 288.4 KB – index – SolrIndexer NO transformers
11:42:15,485 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-8] 9             Finished in 0 ms Transformer NOT called


The result in share is "Could not load pdf content"

Ok the weird thing i noticed

The target file on the debug is 0KB under tomcat/temp/afresco directory and once i get the error message in the preview that it cannot load pdf file, then another source file PDF is created from the DWG that is working just fine. Meaning that i have 3 files under tomcat/temp directory
1) RuntimeExecutableContentTransformerWorker_source_1366542181829387142.dwg (this is the source file)
2) RuntimeExecutableContentTransformerWorker_target_1118018117675185787.pdf (this one is 0KB size file)
3) RuntimeExecutableContentTransformerWorker_source_1366542181829387142.pdf (this is the correct converted dwg file but it only appears after i get the error message in the share previewer)

Another notice
The transform only occurs for newly uploaded files if the file already exists in the repository it wont try the conversion

Please advice

Kind Regards

Christos

PS To Forum admin:
i apoligize for the double post but i hope here to get more answers and help than the non-technical forum
Please either delete or merge this thread http://forums.alfresco.com/forum/general/non-technical-alfresco-discussion/dwg-transformation-07292014-0940 with this one

Thank you in advance

Outcomes