You are on page 1of 21

4/28/2019

All Places > Alfresco Content Services (ECM) > Questions


[SOLVED] DWG transformation | Alfresco Community

Log in to create and rate content, and to follow, bookmark, and share content with other members. Not a member? Join Now!


ASSUMED ANSWERED

[SOLVED] DWG transformation


Question asked by tsafarog on Jul 29, 2014
Latest reply on Aug 5, 2014 by tsafarog 

 Like • 0  Comment • 26

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-transformation-09112007-2123

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)

1
2 ?xml version='1.0' encoding='UTF-8'?>
3 <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd '>
4
5 <beans>
6
7 <bean id="transformer.worker.dwg2pdf" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker">
8 <property name="mimetypeService">
9 <ref bean="mimetypeService" />
10 </property>
11 <property name="checkCommand">
12 <bean class="org.alfresco.util.exec.RuntimeExec">
13 <property name="commandsAndArguments">
14 <map>
15 <entry key=".*">
16 <list>
17 <value>E:\ECM\bin\IrfanView\i_view32.exe</value>
18 <value>E:\ECM\bin\IrfanView\jtp.gif</value>
19 <value>/convert=E:\ECM\bin\IrfanView\jtp.png</value>
20 </list>
21 </entry>
22 </map>
23 </property>
https://community.alfresco.com/thread/209561-solved-dwg-transformation 1/21
24 4/28/2019 </bean> [SOLVED] DWG transformation | Alfresco Community
25 </property>
26 <property name="transformCommand">
27 <bean class="org.alfresco.util.exec.RuntimeExec">
28 <property name="commandsAndArguments">
29 <map>
30 <entry key=".*">
31 <list>
32 <value>E:\ECM\bin\IrfanView\i_view32.exe</value>
33 <value>${source}</value>
34 <value>/convert=${target}</value>
35 </list>
36 </entry>
37 </map>
38 </property>
39 <property name="errorCodes">
40 <value>1,2</value>
41 </property>
42 </bean>
43 </property>
44 <property name="explicitTransformations">
45 <list>
46 <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
47 <property name="sourceMimetype"><value>image/x-dwg</value></property>
48 <property name="targetMimetype"><value>application/pdf</value></property>
49 </bean>
50 </list>
51 </property>
52 </bean>
53
54 <bean id="transformer.dwg2pdf" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransformer">
55 <property name="worker">
56 <ref bean="transformer.worker.dwg2pdf" />
57 </property>
58 </bean>
59
60
61 <!– DWG to SWF –>
62
63 <bean id="transformer.complex.dwg2pdf.pdf2swf"
64 class="org.alfresco.repo.content.transform.ComplexContentTransformer"
65 parent="baseContentTransformer" >
66 <property name="transformers">
67 <list>
68 <ref bean="transformer.dwg2pdf" />
69 <ref bean="transformer.pdf2swf" />
70 </list>
71 </property>
72 <property name="intermediateMimetypes">
73 <list>
74 <value>application/pdf</value>
75 </list>
76 </property>
77 <property name="explicitTransformations">
78 <list>
79 <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
80 <property name="sourceMimetype"><value>image/x-dwg</value></property>
81 <property name="targetMimetype"><value>application/x-shockwave-flash</value></property>
82 </bean>
83 </list>
84 </property>
85 </bean>
86
87 </beans>
88
89

https://community.alfresco.com/thread/209561-solved-dwg-transformation 2/21
4/28/2019 [SOLVED] DWG transformation | Alfresco Community

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")

No one else has this question

Visibility:  Alfresco Content Services (ECM) • 903 Views

Last modified on Jul 29, 2014 10:40 AM

Tags: repository repository services

Categories: Customization

26 Replies

tsafarog
Jul 30, 2014 10:09 AM

Update:

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

1
2 <alfresco-config area="mimetype-map">
3
4 <config evaluator="string-compare" condition="Mimetype Map">
5 <mimetypes>
6
7 <mimetype mimetype="image/vnd.dwg" display="Autocad Drawing">
8 <extension>dwg</extension>
9 </mimetype>
10
11 </mimetypes>
12 </config>
13
14 </alfresco-config>
15

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

https://community.alfresco.com/thread/209561-solved-dwg-transformation 3/21
4/28/2019 [SOLVED] DWG transformation | Alfresco Community
1
2
3 image/vnd.dwg - dwg
4
5
6 Extractors: org.alfresco.repo.content.metadata.DWGMetadataExtracter
7
8
9 Transformable To: •application/pdf = Proxy via: org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker ()
10 •application/x-shockwave-flash = Complex via: application/pdf
11
12 Transformable From: Cannot be generated from anything else
13

I updated the script with the below

1
2 <?xml version='1.0' encoding='UTF-8'?>
3 <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd '>
4
5 <beans>
6
7 <!– TRASFORMA DWG IN PDF –>
8 <bean id="transformer.worker.dwg2pdf" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker">
9 <property name="mimetypeService">
10 <ref bean="mimetypeService" />
11 </property>
12 <property name="checkCommand">
13 <bean class="org.alfresco.util.exec.RuntimeExec">
14 <property name="commandsAndArguments">
15 <map>
16 <entry key=".*">
17 <list>
18 <value>E:\ECM\bin\IrfanView\i_view32.exe</value>
19 <value>E:\ECM\bin\IrfanView\jtp.gif</value>
20 <value>/convert=jtp.png</value>
21 </list>
22 </entry>
23 </map>
24 </property>
25 </bean>
26 </property>
27 <property name="transformCommand">
28 <bean class="org.alfresco.util.exec.RuntimeExec">
29 <property name="commandsAndArguments">
30 <map>
31 <entry key=".*">
32 <list>
33 <value>E:\ECM\bin\IrfanView\i_view32.exe</value>
34 <value>${source}</value>
35 <value>/convert=${target}</value>
36 </list>
37 </entry>
38 </map>
39 </property>
40 <property name="errorCodes">
41 <value>1,2</value>
42 </property>
43 </bean>
44 </property>
45 <property name="explicitTransformations">
46 <list>
47 <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
48 <property name="sourceMimetype"><value>image/vnd.dwg</value></property>
https://community.alfresco.com/thread/209561-solved-dwg-transformation 4/21
4/28/2019
49 [SOLVED] DWG transformation | Alfresco Community
<property name="targetMimetype"><value>application/pdf</value></property>
50 </bean>
51 </list>
52 </property>
53 </bean>
54 <bean id="transformer.dwg2pdf" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransforme
55 <property name="worker">
56 <ref bean="transformer.worker.dwg2pdf" />
57 </property>
58 </bean>
59
60 <!– TRASFORMA DWG IN SWF (complex) –>
61 <bean id="transformer.complex.dwg2pdf.Pdf2swf"
62 class="org.alfresco.repo.content.transform.ComplexContentTransformer"
63 parent="baseContentTransformer" >
64 <property name="transformers">
65 <list>
66 <ref bean="transformer.dwg2pdf" />
67 <ref bean="transformer.Pdf2swf" />
68 </list>
69 </property>
70 <property name="intermediateMimetypes">
71 <list>
72 <value>application/pdf</value>
73 </list>
74 </property>
75 <property name="explicitTransformations">
76 <list>
77 <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
78 <property name="sourceMimetype"><value>image/vnd.dwg</value></property>
79 <property name="targetMimetype"><value>application/x-shockwave-flash</value></property>
80 </bean>
81 </list>
82 </property>
83 </bean>
84
85 </beans>
86

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

 Actions  Like • 0

tsafarog
Jul 31, 2014 11:06 AM

also i paste here my alfresco-global.properties in case there is also something wrong in here

1
2
3 ###############################
4 ## Common Alfresco Properties #
5 ###############################
6
7 dir.root=E:/ECM/alf_data
8
9 alfresco.context=alfresco
10 alfresco.host=127.0.0.1
11 alfresco.port=8080
12 alfresco.protocol=http
https://community.alfresco.com/thread/209561-solved-dwg-transformation 5/21
4/28/2019
13 [SOLVED] DWG transformation | Alfresco Community
14 share.context=share
15 share.host=127.0.0.1
16 share.port=8080
17 share.protocol=http
18
19 ### database connection properties ###
20 db.driver=org.postgresql.Driver
21 db.username=alfresco
22 db.password=**********
23 db.name=alfresco
24 db.url=jdbc:postgresql://localhost:5432/${db.name}
25
26 # The server mode. Set value here
27 # UNKNOWN | TEST | BACKUP | PRODUCTION
28 system.serverMode=UNKNOWN
29
30 ### FTP Server Configuration ###
31 ftp.enabled=true
32 ftp.port=21
33
34 ### RMI service ports ###
35 alfresco.rmi.services.port=50500
36 avm.rmi.service.port=0
37 avmsync.rmi.service.port=0
38 attribute.rmi.service.port=0
39 authentication.rmi.service.port=0
40 repo.rmi.service.port=0
41 action.rmi.service.port=0
42 deployment.rmi.service.port=0
43
44 ### External executable locations ###
45 ooo.exe=E:/ECM/libreoffice/App/libreoffice/program/soffice.exe
46 ooo.enabled=true
47 ooo.port=8100
48 img.root=E:/ECM/imagemagick
49 img.coders=${img.root}/modules/coders
50 img.config=${img.root}/config
51 img.gslib=${img.root}/lib
52 img.exe=${img.root}/convert.exe
53 swf.exe=E:/ECM/swftools/pdf2swf.exe
54 swf.languagedir=E:/ECM/swftools/japanese
55 dwg.exe=E:/ECM/bin/IrfanView/i_view32.exe
56 # img.gslib=C:/Program Files (x86)/gs/gs9.09/lib
57
58 jodconverter.enabled=false
59 jodconverter.officeHome=./libreoffice/App/libreoffice
60 jodconverter.portNumbers=8100
61
62 ### Initial admin password ###
63 alfresco_user_store.adminpassword=59e144b26679107fa90ce52413d453eb
64
65 ### E-mail site invitation setting ###
66 notification.email.siteinvite=false
67
68 ### License location ###
69 dir.license.external=E:/ECM
70
71 ### Solr indexing ###
72 index.subsystem.name=solr
73 dir.keystore=${dir.root}/keystore
74 solr.port.ssl=8443
75
76 ### BPM Engine ###
77 system.workflow.engine.jbpm.enabled=false
78
79
https://community.alfresco.com/thread/209561-solved-dwg-transformation 6/21
4/28/2019
80 ### Allow extended ResultSet processing [SOLVED] DWG transformation | Alfresco Community
81 security.anyDenyDenies=false

 Actions  Like • 0

xiaoqunhua
@ tsafarog on Aug 1, 2014 4:22 AM

Hi, What about IrfanView software/tool with AutoCAD(dwg) files?

 Actions  Like • 0

tsafarog
@ xiaoqunhua on Aug 1, 2014 7:00 AM

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

 Actions  Like • 0

xiaoqunhua
Aug 1, 2014 8:28 AM

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.

 Actions  Like • 0

tsafarog
@ xiaoqunhua on Aug 1, 2014 9:30 AM

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

1
2 ### External executable locations ###
3 ooo.exe=E:\\ECM\\libreoffice\\App\\libreoffice\\program\\soffice.exe
4 ooo.enabled=true
5 ooo.port=8100
6 img.root=E:\\ECM\\imagemagick
7 img.coders=${img.root}\\modules\\coders
8 img.config=${img.root}\\config
9 img.gslib=${img.root}\\lib
10 img.exe=${img.root}\\convert.exe
11 swf.exe=E:\\ECM\\swftools\\pdf2swf.exe
12 swf.languagedir=E:\\ECM\\swftools\\japanese
https://community.alfresco.com/thread/209561-solved-dwg-transformation 7/21
4/28/2019
13 [SOLVED] DWG transformation | Alfresco Community
dwg.exe=E:\\ECM\\bin\\IrfanView\\i_view32.exe
14 img.gslib=E:\\ECM\\bin\\gs9.09\\lib
15
16 jodconverter.enabled=true
17 jodconverter.officeHome=E:\\ECM\\libreoffice\\App\\libreoffice
18 jodconverter.portNumbers=8100
19

and this is how transformer looks

1
2 <?xml version='1.0' encoding='UTF-8'?>
3 <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd '>
4
5 <beans>
6
7 <!– TRASFORMA DWG IN PDF –>
8 <bean id="transformer.worker.dwg2pdf" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker">
9 <property name="mimetypeService">
10 <ref bean="mimetypeService" />
11 </property>
12 <property name="checkCommand">
13 <bean class="org.alfresco.util.exec.RuntimeExec">
14 <property name="commandsAndArguments">
15 <map>
16 <entry key=".*">
17 <list>
18 <value>${dwg.exe}</value>
19 <value>E:\ECM\bin\IrfanView\dtp.dwg</value>
20 <value>/convert=dtp.pdf</value>
21 </list>
22 </entry>
23 </map>
24 </property>
25 </bean>
26 </property>
27 <property name="transformCommand">
28 <bean class="org.alfresco.util.exec.RuntimeExec">
29 <property name="commandsAndArguments">
30 <map>
31 <entry key=".*">
32 <list>
33 <value>${dwg.exe}</value>
34 <value>${source}</value>
35 <value>/convert=${target}</value>
36 </list>
37 </entry>
38 </map>
39 </property>
40 </bean>
41 </property>
42 <property name="explicitTransformations">
43 <list>
44 <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
45 <property name="sourceMimetype"><value>image/vnd.dwg</value></property>
46 <property name="targetMimetype"><value>application/pdf</value></property>
47 </bean>
48 </list>
49 </property>
50 </bean>
51 <bean id="transformer.dwg2pdf" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransf
52 <property name="worker">
53 <ref bean="transformer.worker.dwg2pdf" />
54 </property>
55 </bean>
https://community.alfresco.com/thread/209561-solved-dwg-transformation 8/21
4/28/2019
56 [SOLVED] DWG transformation | Alfresco Community
57 <!– TRASFORMA DWG IN SWF (complex) –>
58 <bean id="transformer.complex.dwg2pdf.Pdf2swf"
59 class="org.alfresco.repo.content.transform.ComplexContentTransformer"
60 parent="baseContentTransformer" >
61 <property name="transformers">
62 <list>
63 <ref bean="transformer.dwg2pdf" />
64 <ref bean="transformer.Pdf2swf" />
65 </list>
66 </property>
67 <property name="intermediateMimetypes">
68 <list>
69 <value>application/pdf</value>
70 </list>
71 </property>
72 <property name="explicitTransformations">
73 <list>
74 <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
75 <property name="sourceMimetype"><value>image/vnd.dwg</value></property>
76 <property name="targetMimetype"><value>application/x-shockwave-flash</value></property>
77 </bean>
78 </list>
79 </property>
80 </bean>
81
82 </beans>
83

 Actions  Like • 0

tsafarog
Aug 1, 2014 9:46 AM

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

1
2 <bean class="org.alfresco.util.exec.RuntimeExec">
3 <property name="commandsAndArguments">
4 <map>
5 <entry key=".*">
6 <list>
7 <value>${dwg.exe}</value>
8 <value>${source}</value>
9 <value>/convert=${target}</value>
10 </list>
11 </entry>
12 </map>
13 </property>
14 </bean>
15

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

If i https://community.alfresco.com/thread/209561-solved-dwg-transformation
use cmd command i_view32.exe dtp.dwg /convert=dtp.pdf it works and creates the file succesfully with no UI popups 9/21
4/28/2019 [SOLVED] DWG transformation | Alfresco Community
but in transformer and under \tomcat\temp\Alfresco the pdf file i get is 0KB …

 Actions  Like • 0

xiaoqunhua
Aug 1, 2014 10:03 AM

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.

 Actions  Like • 0

tsafarog
@ xiaoqunhua on Aug 1, 2014 10:26 AM

Xiao thank you for your time on this

after your suggestions this is how transformer looks

1
2 <?xml version='1.0' encoding='UTF-8'?>
3 <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd '>
4
5 <beans>
6
7 <!– TRASFORMA DWG IN PDF –>
8 <bean id="transformer.worker.dwg2pdf" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker">
9 <property name="mimetypeService">
10 <ref bean="mimetypeService" />
11 </property>
12 <property name="checkCommand">
13 <bean class="org.alfresco.util.exec.RuntimeExec">
14 <property name="commandsAndArguments">
15 <map>
16 <entry key=".*">
17 <list>
18 <value>${dwg.exe}</value>
19 <value>E:\\ECM\\bin\\IrfanView\\dtp.dwg</value>
20 <value>/convert=dtp.pdf</value>
21 </list>
22 </entry>
23 </map>
24 </property>
25 </bean>
26 </property>
27 <property name="transformCommand">
28 <bean class="org.alfresco.util.exec.RuntimeExec">
29 <property name="commandsAndArguments">
30 <map>
31 <entry key=".*">
32 <list>
33 <value>${dwg.exe}</value>
34 <value>${source}</value>
35 <value>/convert=${target}</value>
36 </list>
37 </entry>
38 </map>
39 </property>
40 </bean>
41 </property>
42 <property name="explicitTransformations">
43 <list>
44 <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
https://community.alfresco.com/thread/209561-solved-dwg-transformation 10/21
4/28/2019
45 [SOLVED] DWG transformation | Alfresco Community
<property name="sourceMimetype"><value>image/vnd.dwg</value></property>
46 <property name="targetMimetype"><value>application/pdf</value></property>
47 </bean>
48 </list>
49 </property>
50 </bean>
51 <bean id="transformer.dwg2pdf" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTransf
52 <property name="worker">
53 <ref bean="transformer.worker.dwg2pdf" />
54 </property>
55 </bean>
56
57 <!– TRASFORMA DWG IN SWF (complex) –>
58 <bean id="transformer.complex.dwg2pdf.Pdf2swf"
59 class="org.alfresco.repo.content.transform.ComplexContentTransformer"
60 parent="baseContentTransformer" >
61 <property name="transformers">
62 <list>
63 <ref bean="transformer.dwg2pdf" />
64 <ref bean="transformer.Pdf2swf" />
65 </list>
66 </property>
67 <property name="intermediateMimetypes">
68 <list>
69 <value>application/pdf</value>
70 </list>
71 </property>
72 <property name="explicitTransformations">
73 <list>
74 <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
75 <property name="sourceMimetype"><value>image/vnd.dwg</value></property>
76 <property name="targetMimetype"><value>application/x-shockwave-flash</value></property>
77 </bean>
78 </list>
79 </property>
80 </bean>
81
82 </beans>
83

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…

 Actions  Like • 0

rjohnson
@ tsafarog on Aug 2, 2014 3:56 AM

First, when developing transformations, turn on information level messaging for transforms. This is in log4j properties file. This will cause Alfresco to dump out
just about everything its doing to the logs.

Second, your transform above seems to try and go beyond PDF and into SWF, which I suspect you don't want to do.

Third your my-sites.get.js error is about IMAP and nothing to do with this transform.

Finally as at 4.? you also need to set up your transforms in alfresco-global.properties and not in your XML. This change is in the community information but its not
that explicit and many many examples are from the older way of setting up transforms which can have some nasty side effects in the more recent releases.

https://community.alfresco.com/thread/209561-solved-dwg-transformation 11/21
4/28/2019 [SOLVED]
Here is a transform I wrote to do html to pdf using wkhtmltopdf. DWG
To avoid transformation
overwriting | Alfresco
the standard Community
transform for html to pdf (which uses LibreOffice) I defined an
additional mimetype with extension obc

1
2 <?xml version='1.0' encoding='UTF-8'?>
3 <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd '>
4
5 <beans>
6 <bean id="transformer.worker.html2pdf" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWor
7 <property name="mimetypeService">
8 <ref bean="mimetypeService" />
9 </property>
10 <property name="checkCommand">
11 <bean class="org.alfresco.util.exec.RuntimeExec">
12 <property name="commandMap">
13 <map>
14 <entry key=".*">
15 <value>/usr/local/bin/wkhtmltopdf -help</value>
16 </entry>
17 </map>
18 </property>
19 <property name="errorCodes">
20 <value>2</value>
21 </property>
22 </bean>
23 </property>
24 <property name="transformCommand">
25 <bean class="org.alfresco.util.exec.RuntimeExec">
26 <property name="commandsAndArguments">
27 <map>
28 <entry key="Linux">
29 <list>
30 <value>sh</value>
31 <value>-c</value>
32 <value>/usr/local/bin/html2pdf '${source}' '${target}'</value>
33 </list>
34 </entry>
35 <entry key="Windows.*">
36 <list>
37 <value>cmd</value>
38 <value>/C</value>
39 <value>/usr/local/bin/html2pdf "${source}" "${target}"</value>
40 </list>
41 </entry>
42 </map>
43 </property>
44 <property name="errorCodes">
45 <value>2</value>
46 </property>
47 </bean>
48 </property>
49 </bean>
50 <bean id="transformer.html2pdf" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentT
51 <property name="worker">
52 <ref bean="transformer.worker.html2pdf" />
53 </property>
54 </bean>
55 </beans>
56

and the alfresco-global.properties entries are:-

https://community.alfresco.com/thread/209561-solved-dwg-transformation 12/21
4/28/2019 [SOLVED] DWG transformation | Alfresco Community
1
2 # What follows are the custom transforms
3 # for outbound letters
4 # the imput format is actually HTML
5 # the output PDF
6 # Define a default priority for the transformer
7 content.transformer.html2pdf.priority=50
8 # List the transformations that are supported
9 content.transformer.html2pdf.extensions.obc.pdf.supported=true
10 content.transformer.html2pdf.extensions.obc.pdf.priority=50
11

 Actions  Like • 0

tsafarog
@ rjohnson on Aug 5, 2014 7:40 AM

Bob thank you so much for your usefull information…

I must admit that i missed the part that sais that you need to mention the transformer in the global config.

I will try what you suggested but for the record the site.js error i get it only if i dont do something right in the transformer.. if i remove the transformer i get no
errors.

Thank you again and i will update asap

 Actions  Like • 0

tsafarog
@ rjohnson on Aug 5, 2014 10:01 AM

Update

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

So now my tranformer looks like this and according to Bob's directions (thanks for your input)

1
2 <?xml version='1.0' encoding='UTF-8'?>
3 <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd '>
4
5 <beans>
6
7 <!– TRASFORMA DWG IN PDF –>
8 <bean id="transformer.worker.dwg2pdf" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWork
9 <property name="mimetypeService">
10 <ref bean="mimetypeService" />
11 </property>
12 <property name="checkCommand">
13 <bean class="org.alfresco.util.exec.RuntimeExec">
14 <property name="commandsAndArguments">
15 <map>
16 <entry key=".*">
17 <list>
18 <value>cmd</value>
19 <value>/C</value>
20 <value>E:\\ECM\\bin\\acme\\AcmeCADConverter.exe /r /ad /f 104 E:\\ECM\\bin\\acme\\dtp.dwg dtp.pdf</val
21 </list>
22 </entry>
23 </map>
24 </property>
https://community.alfresco.com/thread/209561-solved-dwg-transformation 13/21
4/28/2019 25 <property name="errorCodes"> [SOLVED] DWG transformation | Alfresco Community
26 <value>1,2</value>
27 </property>
28 </bean>
29 </property>
30 <property name="transformCommand">
31 <bean class="org.alfresco.util.exec.RuntimeExec">
32 <property name="commandsAndArguments">
33 <map>
34 <entry key="Linux">
35 <list>
36 <value>sh</value>
37 <value>-c</value>
38 <value>E:\\ECM\\bin\\acme\\AcmeCADConverter.exe /r /ad /f 104 '${source}' '${target}'</value>
39 </list>
40 </entry>
41 <entry key="Windows.*">
42 <list>
43 <value>cmd</value>
44 <value>/C</value>
45 <value>E:\\ECM\\bin\\acme\\AcmeCADConverter.exe /r /ad /f 104 "${source}" "${target}"</value>
46 </list>
47 </entry>
48 </map>
49 </property>
50 <property name="errorCodes">
51 <value>1,2</value>
52 </property>
53 </bean>
54 </property>
55 <property name="explicitTransformations">
56 <list>
57 <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
58 <property name="sourceMimetype"><value>image/vnd.dwg</value></property>
59 <property name="targetMimetype"><value>application/pdf</value></property>
60 </bean>
61 </list>
62 </property>
63 </bean>
64 <bean id="transformer.dwg2pdf" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseConten
65 <property name="worker">
66 <ref bean="transformer.worker.dwg2pdf" />
67 </property>
68 </bean>
69
70 </beans>
71

I also updated global.properties file as following

1
2 ### External executable locations ###
3 ooo.exe=E:\\ECM\\libreoffice\\App\\libreoffice\\program\\soffice.exe
4 ooo.enabled=true
5 ooo.port=8100
6 img.root=E:\\ECM\\imagemagick
7 img.coders=${img.root}\\modules\\coders
8 img.config=${img.root}\\config
9 img.gslib=${img.root}\\lib
10 img.exe=${img.root}\\convert.exe
11 swf.exe=E:\\ECM\\swftools\\pdf2swf.exe
12 swf.languagedir=E:\\ECM\\swftools\\japanese
13 dwg.exe=E:\\ECM\\bin\\acme\\AcmeCADConverter.exe
14 img.gslib=E:\\ECM\\bin\\gs9.09\\lib
https://community.alfresco.com/thread/209561-solved-dwg-transformation 14/21
4/28/2019 15 [SOLVED] DWG transformation | Alfresco Community
16 jodconverter.enabled=true
17 jodconverter.officeHome=E:\\ECM\\libreoffice\\App\\libreoffice
18 jodconverter.portNumbers=8100
19
20 # What follows are the custom transforms
21 # Imput dwg the output is PDF
22 # Define a default priority for the transformer
23 content.transformer.dwg2pdf.priority=50
24 # List the transformations that are supported
25 content.transformer.dwg2pdf.extensions.dwg.pdf.supported=true
26 content.transformer.dwg2pdf.extensions.dwg.pdf.priority=50
27

THIS LOG OUTPUT

1
2 11:41:45,596 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-5] 6 dwg txt
3 11:41:45,596 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-5] 6 Finished
4
5 11:41:45,690 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-9] 7 dwg txt
6 11:41:45,690 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-9] 7 Finished
7
8 11:41:53,672 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [pool-17-thread-1] 8 dwg pdf GRA
9 11:41:53,672 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [pool-17-thread-1] 8 **a) [50] dw
10 11:41:53,672 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [pool-17-thread-1] 8.1 dwg pdf GRA
11 11:42:06,938 DEBUG [org.alfresco.util.exec.RuntimeExec] [pool-17-thread-1] Execution result:
12 os: Windows Server 2012
13 command: cmd /C "E:\\ECM\\bin\\acme\\AcmeCADConverter.exe /r /ad /f 104 "E:\ECM\tomcat\temp\Alfresco\RuntimeExecut
14 succeeded: true
15 exit code: 0
16 out:
17 err:
18 11:42:06,953 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [pool-17-thread-1] 8 Finished in 1
19
20 11:42:15,485 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-8] 9 dwg txt
21 11:42:15,485 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-8] 9 Finished
22

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 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

https://community.alfresco.com/thread/209561-solved-dwg-transformation 15/21
4/28/2019  Actions [SOLVED] DWG transformation | Alfresco Community  Like • 0

tsafarog
Aug 6, 2014 10:58 AM

It would be really nice if an admin could move this to developer section so i could get some more views and help

Sorry for the inconvinience

Kind regards

 Actions  Like • 0

afaust
@ tsafarog on Aug 7, 2014 9:39 PM

Hello,

as per your request I have moved this thread into Developer Discussions => Repository Services (which includes transformation services).
I will check if I can do something about https://forums.alfresco.com/forum/developer-discussions/alfresco-share-development/dwg-pdf-transformation-08072014-1056
but it seems I can not do as much in that sub-forum as I could with this thread.

Regards
Axel

 Actions  Like • 0

tsafarog
@ afaust on Aug 8, 2014 6:28 AM

Thank you very much Mr Faust,

i ll try and close that other thread

I am updating the last script with the latest tries i performed but i believe this is not a script error….. for some reason i am still getting 3 files in the temp directory
and the converted file is 0KB

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:

1
2 <?xml version='1.0' encoding='UTF-8'?>
3 <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd '>
4
5 <beans>
6
7 <!– TRASFORMA DWG IN PDF –>
8 <bean id="transformer.worker.dwg2pdf" class="org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerWorker"
9 <property name="mimetypeService">
10 <ref bean="mimetypeService" />
11 </property>
12 <property name="checkCommand">
13 <bean name="transformer.dwg2pdf.checkCommand" class="org.alfresco.util.exec.RuntimeExec">
14 <property name="commandsAndArguments">
15 <map>
https://community.alfresco.com/thread/209561-solved-dwg-transformation 16/21
4/28/201916 <entry key=".*"> [SOLVED] DWG transformation | Alfresco Community
17 <list>
18 <value>cmd</value>
19 <value>/C</value>
20 <value>${dwg2pdf.root}/AcmeCADConverter.exe /r /ad /f 104 E:\ECM\bin\acme\dtp.dwg dtp.pdf</value>
21 </list>
22 </entry>
23 </map>
24 </property>
25 </bean>
26 </property>
27 <property name="transformCommand">
28 <bean name="transformer.dwg2pdf.Command" class="org.alfresco.util.exec.RuntimeExec">
29 <property name="commandsAndArguments">
30 <map>
31 <entry key="Linux.*">
32 <list>
33 <value>sh</value>
34 <value>-c</value>
35 <value>${dwg2pdf.root}/AcmeCADConverter /r /ad /f 104 ${source} ${target}</value>
36 </list>
37 </entry>
38 <entry key="Windows.*">
39 <list>
40 <value>cmd</value>
41 <value>/C</value>
42 <value>${dwg2pdf.root}/AcmeCADConverter.exe /r /ad /f 104 ${source} ${target}</value>
43 </list>
44 </entry>
45 </map>
46 </property>
47 <property name="waitForCompletion">
48 <value>true</value>
49 </property>
50 </bean>
51 </property>
52 <property name="explicitTransformations">
53 <list>
54 <bean class="org.alfresco.repo.content.transform.ExplictTransformationDetails" >
55 <property name="sourceMimetype"><value>image/vnd.dwg</value></property>
56 <property name="targetMimetype"><value>application/pdf</value></property>
57 </bean>
58 </list>
59 </property>
60 </bean>
61
62 <bean id="transformer.proxy.dwg2pdf" class="org.alfresco.repo.management.subsystems.SubsystemProxyFactory">
63 <property name="sourceApplicationContextFactory">
64 <ref bean="thirdparty"/>
65 </property>
66 <property name="sourceBeanName">
67 <value>transformer.worker.dwg2pdf</value>
68 </property>
69 <property name="interfaces">
70 <list>
71 <value>org.alfresco.repo.content.transform.ContentTransformerWorker</value>
72 </list>
73 </property>
74 </bean>
75
76 <bean id="transformer.dwg2pdf" class="org.alfresco.repo.content.transform.ProxyContentTransformer" parent="baseContentTr
77 <property name="worker">
78 <ref bean="transformer.worker.dwg2pdf" />
79 </property>
80 </bean>
81
82 </beans>
https://community.alfresco.com/thread/209561-solved-dwg-transformation 17/21
4/28/2019 [SOLVED] DWG transformation | Alfresco Community

I also updated global.properties file as following

1
2 ### External executable locations ###
3 ooo.exe=E:\\ECM\\libreoffice\\App\\libreoffice\\program\\soffice.exe
4 ooo.enabled=true
5 ooo.port=8100
6 img.root=E:\\ECM\\imagemagick
7 img.coders=${img.root}\\modules\\coders
8 img.config=${img.root}\\config
9 img.gslib=${img.root}\\lib
10 img.exe=${img.root}\\convert.exe
11 swf.exe=E:\\ECM\\swftools\\pdf2swf.exe
12 swf.languagedir=E:\\ECM\\swftools\\japanese
13 dwg2pdf.root=E:\\ECM\\bin\\acme
14 img.gslib=E:\\ECM\\bin\\gs9.09\\lib
15
16 jodconverter.enabled=true
17 jodconverter.officeHome=E:\\ECM\\libreoffice\\App\\libreoffice
18 jodconverter.portNumbers=8100
19
20 # What follows are the custom transforms
21 # Imput dwg the output is PDF
22 # Define a default priority for the transformer
23 content.transformer.dwg2pdf.priority=50
24 # List the transformations that are supported
25 content.transformer.dwg2pdf.extensions.dwg.pdf.supported=true
26 content.transformer.dwg2pdf.extensions.dwg.pdf.priority=50
27

THIS LOG OUTPUT

1
2 11:41:45,596 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-5] 6 dwg txt GR
3 11:41:45,596 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-5] 6 Finished in
4
5 11:41:45,690 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-9] 7 dwg txt GR
6 11:41:45,690 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-9] 7 Finished in
7
8 11:41:53,672 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [pool-17-thread-1] 8 dwg pdf GRAMMI
9 11:41:53,672 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [pool-17-thread-1] 8 **a) [50] dwg2p
10 11:41:53,672 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [pool-17-thread-1] 8.1 dwg pdf GRAMMI
11 11:42:06,938 DEBUG [org.alfresco.util.exec.RuntimeExec] [pool-17-thread-1] Execution result:
12 os: Windows Server 2012
13 command: cmd /C "E:\\ECM\\bin\\acme\\AcmeCADConverter.exe /r /ad /f 104 "E:\ECM\tomcat\temp\Alfresco\RuntimeExecutabl
14 succeeded: true
15 exit code: 0
16 out:
17 err:
18 11:42:06,953 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [pool-17-thread-1] 8 Finished in 13.2
19
20 11:42:15,485 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-8] 9 dwg txt GR
21 11:42:15,485 DEBUG [org.alfresco.repo.content.transform.TransformerDebug] [http-bio-8443-exec-8] 9 Finished in
22

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

https://community.alfresco.com/thread/209561-solved-dwg-transformation 18/21
4/28/2019
Ok the weird thing i noticed [SOLVED] DWG transformation | Alfresco Community

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

 Actions  Like • 0

tsafarog
Aug 16, 2014 12:37 PM

so anyone with an idea? do you need me to post some more info?

Kind regards

 Actions  Like • 0

kaynezhang
Aug 16, 2014 5:02 PM

I guess the issue is caused by AcmeCADConverter,you might give it wrong parameters which leads it always saving the output file(pdf file) into the same folder as the
input file(dwg file) and with the same name,only a different extension.
So even if the output pdf file is generated ,but it is not named according alfresco'need. And an empty pdf file is created when alfresco try to read the correct path(in your
case

1 RuntimeExecutableContentTransformerWorker_target_1118018117675185787.pdf

).

 Actions  Like • 0

tsafarog
@ kaynezhang on Aug 18, 2014 11:28 AM

but aren't ${source} and ${target} the full input and output paths?

Here are all the command line supported commands for acme cad converter http://www.dwg2pdf.biz/dwg-converter/cmd.htm

If anyone has a command suggestion please share

Kind regards and thank you in advance for your time

 Actions  Like • 0

kaynezhang
https://community.alfresco.com/thread/209561-solved-dwg-transformation 19/21
4/28/2019
Aug 18, 2014 2:28 PM [SOLVED] DWG transformation | Alfresco Community

Yes ${source} and ${target} are the full input and output path.
But AcmeDWGConverter command line format is like following

1
2 AcmeDWGConverter [/r] [/e] [/m] [/info] [/l filaname] [/ls] [/info] [/p integer] [/w integer] [/h integer] [/b integer] [/j intege
3

But it seems command line format says that [filename] [filename] are all input parameter.I guess you should use /d parameter,write it like this

<code> AcmeCADConverter /r /ad /f 105 /d ${target} ${source}


</code>
I just read it from http://www.dwg2pdf.biz/dwg-converter/cmd.htm ,I have not tested ,you can give it a try.

 Actions  Like • 0

kaynezhang
Aug 18, 2014 2:43 PM

I have checke alfresco transform souce code ,there is nothing wrong with it.
And I also test it ,you should write it like mine

1
2 AcmeCADConverter /r /ad /f 105 /d ${target} ${source}
3

 Actions  Like • 0

tsafarog
@ kaynezhang on Aug 18, 2014 2:50 PM

yeah the /d switch came to my mind also after your first post … i will try tomorrow morning and let you know

Thank you very much for your usefull input Kaynezhang :)

 Actions  Like • 0

kaynezhang
Aug 18, 2014 2:53 PM

You should also use /105 instead of /104.


good luck.

 Actions  Like • 0

tsafarog
@ kaynezhang on Aug 25, 2014 6:11 AM

and that was it

Transformation works really nice now

Thank you for your help guys especialy Kaynezhang for his inputs

https://community.alfresco.com/thread/209561-solved-dwg-transformation
 Actions 20/21
Like • 0
4/28/2019 [SOLVED] DWG transformation | Alfresco Community

kaynezhang
@ tsafarog on Aug 25, 2014 6:34 AM

Ok,good luck

 Actions  Like • 0

xiaoqunhua
@ tsafarog on Aug 27, 2014 8:36 AM

Hi,tsafarog. Can you paste all you detailed config? I want to try it with AcmeCadconverter.
Thanks advance!

 Actions  Like • 0

xiaoqunhua
@ tsafarog on Aug 28, 2014 4:48 AM

I solved it, thanks.

 Actions  Like • 0

Related Content

DWG to PDF Transformation

Invite to user gives failure - 500 Internal Server Error

AD problem in 2.1.0

LDAP synchronization problem

Alfresco 3.3g and Intelliant OCR 1.1.0

Recommended Content

Alfresco doesn't support two schema

JavaScript API Cookbook

Funcionalidade do alfresco em português

DB Schema update fails on upgrade 4.0.0->4.2.b

Repo content model Unexpanded entity reference

The Alfresco community is designed to help you learn about the possibilities of the Alfresco platform.
Join now to get started!
Register Forums Blogs Wiki Sitemap

© 2016 Alfresco Software, Inc. All Rights Reserved. visit Alfresco.com

Home | Top of page | Help

https://community.alfresco.com/thread/209561-solved-dwg-transformation 21/21

You might also like