cancel
Showing results for 
Search instead for 
Did you mean: 

Autocad (dwg) to pdf transformation

konsultex
Confirmed Champ
Confirmed Champ
I need to transform dwg files to pdf for read access by a group pf users in another space. I know that this is not something Alfresco does out of the box but I wonder if anyone has a suggestions. I imagine that there is some tool that can be called from the command line to do this. This leads to another question related to this problem. Since Alfresco uses OpenOffice to convert documents, I assume that I can configure dwg conversions to usat other program. Is this possible and where do I configure these things?
27 REPLIES 27

fast3r
Champ on-the-rise
Champ on-the-rise
This one: http://wiki.alfresco.com/wiki/Content_Transformations#RuntimeExecutableContentTransformerWorker_.28A.... I was under the impression you used that as base for the latest transformer you posted.

Of course I used it… it actually saved me a LOT of time, really good job!
I thought you were talking about some other wiki.

Depending on the type of business you are in (or your company is in) it might be worth the money to join the OpenDesign alliance (http://www.opendwg.org/), they offer a library which you can use to read DWG files and included is also a PDF export library (including partial source). Cad2Svg is based on an older version of the same library, meanwhile compatibility between the library and AutoCAD DWG files has improved a bit, so if you have any DWG files that you can't convert well with cad2svg this could be very appealing.

At the moment we just need basic support for AutoCAD, I just care that this tool (as well as the IrfanView plugin does) can read the newest AutoCAD version DWGs.
Thank you again, I'll try cad2svg first!

morze
Champ in-the-making
Champ in-the-making

mycroes
Champ in-the-making
Champ in-the-making
It possible to use - libredwg?
http://groups.fsf.org/wiki/LibreDWG
http://savannah.gnu.org/projects/libredwg/
Ideas?

It should be. On one of the pages I saw that they have example code to convert DWG to SVG, so you should be able to use it in a similar fashion as I explained for using cad2svg. I.e. you can use libredwg to convert to SVG, convert SVG to PDF using Apache Batik, create a complex converter for this and use the complex converter as base for other converters which require the DWG to PDF transformation.

I might check this out, I didn't know about libreDWG but it seems interesting to say the least.
Regards,

Michael

morze
Champ in-the-making
Champ in-the-making
New description:
http://wiki.alfresco.com/wiki/DWG_Transformations

Thanks to Michael

mycroes
Champ in-the-making
Champ in-the-making
New description:
http://wiki.alfresco.com/wiki/DWG_Transformations

Thanks to Michael

You're welcome! Didn't think anyone would pick it up so fast. Anyway, I'm also going to detail the transformation using Apache's Batik rasterizer there so everyone can use this example without having to invest in developing or acquiring a DWG conversion tool.
Regards,

Michael

fast3r
Champ on-the-rise
Champ on-the-rise
Great job guys!
Thank you!

mycroes
Champ in-the-making
Champ in-the-making
I updated my guide, it now features some details on setting up this transformation using a converter from DWG to SVG. Of course it's very easy to replace cad2svg used in my code with the libreDWG SVG converter, or you can add them both (however I don't know how Alfresco will decide which one to choose, which is bad if one of the converters is doing better than the other.)

View the page with complete config here:
http://wiki.alfresco.com/wiki/DWG_Transformations
Regards,

Michael

anshu_kumar
Star Contributor
Star Contributor
Hello everyone

I need to transform dwg to pdf in Alfresco. I am using Alfresco Enterprise version 4.1.3, tomcat server and MySQL database on Windows machine.

Using information from these links below:
http://wiki.alfresco.com/wiki/DWG_Transformations
http://wiki.alfresco.com/wiki/Content_Transformations

I downloaded and installed a convertor which supports command line. The tool name is "Any DWG to PDF Converter Pro". Check this link for details: https://anydwg.com/dwg2pdf/

Then I set up the transformater for dwg to pdf transformation, named it as "transformer-services-context.xml" and placed it under \tomcat\webapps\alfresco\WEB-INF\classes\alfresco\extension

The content of the file is:-

**************************Start*********************************

<?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>ls</value>
                        <value>${dp.exe}</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>${dp.exe} /InFile ${source} /OutFile ${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>
            <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>
</beans>

**************************End*********************************

And defined the path of the convertor in "alfresco-global.properties",

—————————-Start—————————–

dp.exe=C:/Program Files/Any DWG to PDF Converter Pro/dp.exe

—————————-End—————————–

Then, i created a rule on a folder in Alfresco web client to convert AutoCAD drawings in pdf.
Selected condition - "Item has a mimetype of 'AutoCAD Drawing'"
Selected Action - Copies content to 'Company Home' and transforms to 'Adobe PDF Document'

Now when i upload any autoCAD(.dwg) file, it gets uploaded successfully but does not convert into pdf.

I get the following error.

**************************Start*********************************

Failed to create content due to error: 05260071 Content conversion failed: reader: ContentAccessor[ contentUrl=store://2013/6/26/18/48/fb9862e6-bcde-44d3-8b76-b37c6c82a0c0.bin, mimetype=image/vnd.dwg, size=58496, encoding=UTF-8, locale=en_US] writer: ContentAccessor[ contentUrl=store://2013/6/26/18/48/5e085720-2902-4f5a-a315-2e5fb8605764.bin, mimetype=application/pdf, size=0, encoding=UTF-8, locale=en_US] options: {targetContentProperty={http://www.alfresco.org/model/content/1.0}name, contentReaderNodeRef=workspace://SpacesStore/e61355cf-80f0-424a-b229-176c629edc5d, contentWriterNodeRef=workspace://SpacesStore/4d911ae0-8e01-40f9-8485-617351d828a5, sourceContentProperty={http://www.alfresco.org/model/content/1.0}name, includeEmbedded=false} limits: {timeoutMs=120000, maxPages=-1, readLimitKBytes=-1, maxSourceSizeKBytes=-1, pageLimit=-1, readLimitTimeMs=-1}

**************************End*********************************

Can somebody please take a look at it and help me out with this? Or any other approach that can suffice my objective.

Thanks in Advance.