AnsweredAssumed Answered

Trasformazione dwg in pdf

Question asked by monocromo on Jul 30, 2013
Latest reply on Aug 1, 2013 by monocromo
Ciao a tutti, sto tentando di trasformare un dwg in pdf in modo da avere l'anteprima del documento. Sto procendendo a piccoli step ma ora ho trovato un problema che non riesco a superare.
1) Ho installato un programma che esegue la trasformazione da dwg a pdf da linea di comando.
2) Ho creato il file transformer-services-context.xml nelle extension di Alfresco con il seguente contenuto:


<?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.dwg2pdf" 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>C:/test.bat</value>
                     </list>
                  </entry>
               </map>
            </property>
         </bean>
      </property>
      –>
      <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandsAndArguments">
               <map>
                  <entry key="Windows.*">
                     <list>
                        <value>${dp.exe} ${source} ${target} -cPDF</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/x-dwg</value></property>
               <property name="targetMimetype"><value>application/pdf</value></property>
            </bean>
            <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.dwg2pdf" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransformer">
      <property name="worker">
         <ref bean="transformer.worker.dwg2pdf" />
      </property>
   </bean>
   <!–
   <bean id="transformer.complex.dwg2swf" class="org.alfresco.repo.content.transform.ComplexContentTransformer" parent="baseContentTransformer">
      <property name="transformers">
            <list>
                <ref bean="transformer.dwg2pdf" />
                <ref bean="transformer.Pdf2swf" />
            </list>
        </property>
        <property name="intermediateMimetypes">
            <list>
                <value>application/pdf</value>
            </list>
        </property>
    </bean>
   –>
</beans>



3) Nell'alfresco-global.properties ho inserito il seguente codice: dp.exe=C:/Programmi/TotalCADConverter/CADConverter.exe il quale permette di eseguire il programma di conversione.

4)Ho aggiunto una regola in una cartella che nel momento in cui carico un file viene eseguita la trasformazione del file da dwg a pdf.

Problema:
Quando eseguo l'upload nel file da share la progress bar dell'upload diventa arancione e mi viene notificato il mancato upload, se vado a vedere nel log ho il seguente errore:


Caused by: org.alfresco.service.cmr.repository.ContentIOException: 06300040 Transformation failed - status indicates an error:
Execution result:
   os:         Windows 2003
   command:    "C:/Programmi/TotalCADConverter/CADConverter.exe C:\Alfresco\tomcat\temp\Alfresco\RuntimeExecutableContentTransformerWorker_source_4861565057727707186.dwg C:\Alfresco\tomcat\temp\Alfresco\RuntimeExecutableContentTransformerWorker_target_6861132225763674962.pdf -cPDF"
   succeeded:  false
   exit code:  2
   out:       
   err:        Cannot run program "C:/Programmi/TotalCADConverter/CADConverter.exe C:\Alfresco\tomcat\temp\Alfresco\RuntimeExecutableContentTransformerWorker_source_4861565057727707186.dwg C:\Alfresco\tomcat\temp\Alfresco\RuntimeExecutableContentTransformerWorker_t


ovvero alfresco tenta di seguire la conversione ma per qualche motivo non esegue il comando. Se faccio copia incolla del comando nel prompt la conversione viene fatta correttamente!!! Come mai? Avete qualche idea?

Outcomes