cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED] DWG transformation

tsafarog
Champ on-the-rise
Champ on-the-rise
Hello thank you for reading this

I am trying to use the transformer capabilities of alfresco to get a preview of dwg files.

My sources were:
1)http://wiki.alfresco.com/wiki/Content_Transformations
and the conversation below eventhout it seems a bit outdated.
2)https://forums.alfresco.com/forum/general/non-technical-alfresco-discussion/autocad-dwg-pdf-transfor...

I am using Community version 5

I have tried the pdf transformation using Irfanview. Irfanview has BabaCAD4Image.dll and i can preview there my DWG documents but i also purchased a licence for CS_DWG.dll to test. Nothing works for me i either get a spining cycle when Alfresco share tried to do the preview or i get :

An error has occured in the Share component: /share/service/components/dashlets/my-sites.
It responded with a status of 500 - Internal Error.
Error Code Information: 500 - An error inside the HTTP server which prevented it from fulfilling the request.
Error Message: 06290003 Failed to execute script 'classpath*:alfresco/site-webscripts/org/alfresco/components/dashlets/my-sites.get.js': 06290002 06290003 Failed during processing of IMAP server status configuration from Alfresco: 06290002 Unable to retrieve IMAP server status from Alfresco: 404
Server: Alfresco Spring WebScripts - v1.2.0 (Release 1549) schema 1,000

this is what i have done so far:

I added the mimetype image/x-dwg unders mimetypes-extension-map.xml

Transform to pdf (dwg2pdf-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.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>E:\ECM\bin\IrfanView\i_view32.exe</value>
                  <value>E:\ECM\bin\IrfanView\jtp.gif</value>
                  <value>/convert=E:\ECM\bin\IrfanView\jtp.png</value>
                    </list>
               </entry>
                </map>
            </property>
         </bean>
        </property>
         <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandsAndArguments">
                <map>
            <entry key=".*">
            <list>
                    <value>E:\ECM\bin\IrfanView\i_view32.exe</value>
                  <value>${source}</value>
                  <value>/convert=${target}</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>
         </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>


<!– DWG to SWF –>

<bean id="transformer.complex.dwg2pdf.pdf2swf"
        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>
      <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/x-shockwave-flash</value></property>
            </bean>
         </list>
      </property>   
  </bean>

</beans>



If i add the DGW to PNG transform in the script i cant even get alfresco to load

After doing alterations with no success i tried to make transformer from DWG to PNG and DWG to GIF altering the above script with no success. I am not interested in detailed preview.

Any help would be greatly appreciated to get this working

Thanks in advance

Chris


(Edit by AFaust 2014/08/07: As per the latest comment I have moved the entire thread into "Developer Discussions" => "Repository Services")
26 REPLIES 26

tsafarog
Champ on-the-rise
Champ on-the-rise
Update:


I removed mimetype image/x-dwg and replaced it with image/vnd.dwg and i added it in mimetypes-extension-map.xml


<alfresco-config area="mimetype-map">

   <config evaluator="string-compare" condition="Mimetype Map">
      <mimetypes>

         <mimetype mimetype="image/vnd.dwg" display="Autocad Drawing">
            <extension>dwg</extension>
         </mimetype>

      </mimetypes>
   </config>
  
</alfresco-config>


and now i get under http://localhost:8080/alfresco/service/mimetypes?mimetype=image/vnd.dwg#image/vnd.dwg



image/vnd.dwg - dwg


Extractors: org.alfresco.repo.content.metadata.DWGMetadataExtracter


Transformable To: •application/pdf = Proxy via: org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker ()
•application/x-shockwave-flash = Complex via: application/pdf

Transformable From: Cannot be generated from anything else


I updated the script with the below


<?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 class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandsAndArguments">
                <map>
                    <entry key=".*">
               <list>                  
                        <value>E:\ECM\bin\IrfanView\i_view32.exe</value>
                  <value>E:\ECM\bin\IrfanView\jtp.gif</value>
                  <value>/convert=jtp.png</value>
                    </list>
               </entry>
                </map>
            </property>
         </bean>
        </property>
         <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandsAndArguments">
                <map>
            <entry key=".*">
            <list>
                    <value>E:\ECM\bin\IrfanView\i_view32.exe</value>
                  <value>${source}</value>
                  <value>/convert=${target}</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/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>
   
   <!–      TRASFORMA DWG IN SWF (complex)    –>
    <bean id="transformer.complex.dwg2pdf.Pdf2swf"
        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>
      <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/x-shockwave-flash</value></property>
            </bean>
         </list>
      </property>   
   </bean>
   
</beans>


Once i try to preview my dwg i get a spinning cycle and then the message could not load pdf content….

I am stuck a bit … any advice would be appreciated

tsafarog
Champ on-the-rise
Champ on-the-rise
also i paste here my alfresco-global.properties in case there is also something wrong in here



###############################
## Common Alfresco Properties #
###############################

dir.root=E:/ECM/alf_data

alfresco.context=alfresco
alfresco.host=127.0.0.1
alfresco.port=8080
alfresco.protocol=http

share.context=share
share.host=127.0.0.1
share.port=8080
share.protocol=http

### database connection properties ###
db.driver=org.postgresql.Driver
db.username=alfresco
db.password=**********
db.name=alfresco
db.url=jdbc:postgresql://localhost:5432/${db.name}

# The server mode. Set value here
# UNKNOWN | TEST | BACKUP | PRODUCTION
system.serverMode=UNKNOWN

### FTP Server Configuration ###
ftp.enabled=true
ftp.port=21

### RMI service ports ###
alfresco.rmi.services.port=50500
avm.rmi.service.port=0
avmsync.rmi.service.port=0
attribute.rmi.service.port=0
authentication.rmi.service.port=0
repo.rmi.service.port=0
action.rmi.service.port=0
deployment.rmi.service.port=0

### 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
dwg.exe=E:/ECM/bin/IrfanView/i_view32.exe
# img.gslib=C:/Program Files (x86)/gs/gs9.09/lib

jodconverter.enabled=false
jodconverter.officeHome=./libreoffice/App/libreoffice
jodconverter.portNumbers=8100

### Initial admin password ###
alfresco_user_store.adminpassword=59e144b26679107fa90ce52413d453eb

### E-mail site invitation setting ###
notification.email.siteinvite=false

### License location ###
dir.license.external=E:/ECM

### Solr indexing ###
index.subsystem.name=solr
dir.keystore=${dir.root}/keystore
solr.port.ssl=8443

### BPM Engine ###
system.workflow.engine.jbpm.enabled=false

### Allow extended ResultSet processing
security.anyDenyDenies=false

xiaoqunhua
Champ in-the-making
Champ in-the-making
Hi, What about IrfanView software/tool with AutoCAD(dwg) files?

I try to use irfanview…
but i keep get a spinning circle once i try to preview and also what i noticed is that under .\tomcat\temp\Alfresco i see 2 files
RuntimeExecutableContentTransformerWorker_source_5662957576453154813.dwg with 250kb filesize
and RuntimeExecutableContentTransformerWorker_target_3743969435769205511.pdf with 0kb filesize ….
does it fail to make the conversion?

If i open a cmd and enter the convert command it works ok

xiaoqunhua
Champ in-the-making
Champ in-the-making
Hi, I saw some slash in your config xml file,it looks like E:\ECM\bin\IrfanView\i_view32.exe,I think it should be E\:\\ECM\\bin\\IrfanView\\i_view32.exe. Or you can config the command tool in alf-global.properties file, and then reference it in your tansform config xml file.

Yeah i fixed my global confing i read that it is Java so backslash is escaped

so i add

dwg.exe=E:\\ECM\\bin\\Irfanview\\i.view32.exe

and then to call it i use ${dwg.exe} right?

This is how my global looks now


### 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
dwg.exe=E:\\ECM\\bin\\IrfanView\\i_view32.exe
img.gslib=E:\\ECM\\bin\\gs9.09\\lib

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


and this is how transformer looks


<?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 class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandsAndArguments">
                <map>
                    <entry key=".*">
               <list>                  
                  <value>${dwg.exe}</value>
                  <value>E:\ECM\bin\IrfanView\dtp.dwg</value>
                  <value>/convert=dtp.pdf</value>
                    </list>
               </entry>
                </map>
            </property>
         </bean>
        </property>
         <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandsAndArguments">
                <map>
            <entry key=".*">
            <list>
                  <value>${dwg.exe}</value>
                      <value>${source}</value>
                 <value>/convert=${target}</value>
            </list>      
                </entry>
                </map>
            </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.dwg2pdf" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransformer">
      <property name="worker">
         <ref bean="transformer.worker.dwg2pdf" />
      </property>
   </bean>

   <!–      TRASFORMA DWG IN SWF (complex)    –>
    <bean id="transformer.complex.dwg2pdf.Pdf2swf"
        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>
      <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/x-shockwave-flash</value></property>
            </bean>
         </list>
      </property>   
   </bean>

</beans>

tsafarog
Champ on-the-rise
Champ on-the-rise
I think that what i am doing wrong is the command syntax under TransformCommand property

I have tried so many combination with double " and without with single line and cmd /C values as well but cant get it to work

Can someone point for a correct syntax?

Thanks


<bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandsAndArguments">
                <map>
            <entry key=".*">
            <list>
                  <value>${dwg.exe}</value>
                      <value>${source}</value>
                 <value>/convert=${target}</value>
            </list>      
                </entry>
                </map>
            </property>
         </bean>


I downgraded impdf because i cant get no UI in 0.90 version and i am using CS_dwg.dll

If i use cmd command i_view32.exe dtp.dwg /convert=dtp.pdf it works and creates the file succesfully with no UI popups

but in transformer and under \tomcat\temp\Alfresco the pdf file i get is 0KB …

xiaoqunhua
Champ in-the-making
Champ in-the-making
Hi,your global config is right,but in your tansform config file E:\ECM\bin\IrfanView\dtp.dwg is the same as before.try fix it and try.

Xiao thank you for your time on this

after your suggestions this is how transformer looks


<?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 class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandsAndArguments">
                <map>
                    <entry key=".*">
               <list>                  
                  <value>${dwg.exe}</value>
                  <value>E:\\ECM\\bin\\IrfanView\\dtp.dwg</value>
                  <value>/convert=dtp.pdf</value>
                    </list>
               </entry>
                </map>
            </property>
         </bean>
        </property>
         <property name="transformCommand">
         <bean class="org.alfresco.util.exec.RuntimeExec">
            <property name="commandsAndArguments">
                <map>
            <entry key=".*">
            <list>
                  <value>${dwg.exe}</value>
                      <value>${source}</value>
                 <value>/convert=${target}</value>
            </list>      
                </entry>
                </map>
            </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.dwg2pdf" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransformer">
      <property name="worker">
         <ref bean="transformer.worker.dwg2pdf" />
      </property>
   </bean>

   <!–      TRASFORMA DWG IN SWF (complex)    –>
    <bean id="transformer.complex.dwg2pdf.Pdf2swf"
        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>
      <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/x-shockwave-flash</value></property>
            </bean>
         </list>
      </property>   
   </bean>

</beans>


The weird part is that under CheckCommand property if i try a simple conversion from gif to png it will create the file. Now that i am using DWG to PDF it wont convert.

As i said thou if i use a CMD and type the command E:\ecm\bin\IrfanView\i_view32.exe dtp.dwg /convert=dtp.pdf it will make the conversion without UI popups

I am stuck…