cancel
Showing results for 
Search instead for 
Did you mean: 

DWG to PDF Transformation

tsafarog
Champ on-the-rise
Champ on-the-rise
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-072920... with this one

Thank you in advance
3 REPLIES 3

afaust
Legendary Innovator
Legendary Innovator
Hello,

unfortunately, I can not modify a thread in this sub-forum (I am "just" a moderator from the Alfresco Community), but you should be able to close this thread yourself.
The original (and already intensively discussed thread http://forums.alfresco.com/forum/developer-discussions/repository-services/dwg-transformation-072920... no resides in the correct sub-forum.

Regards
Axel

bhuvan
Champ in-the-making
Champ in-the-making
Hai tsafarog, Same thing I tried in alfresco community 4.2 e with Acme CAD converter 8.6.2 and gs 9.09,I am Unable to convert dwg file into pdf file format I am getting 0KB pdf file instead of full content file.

I am getting following error log While uploading dwg file in folder

2014-09-22 17:13:04,183  ERROR [repo.action.AsynchronousActionExecutionQueueImpl] [defaultAsyncAction1] Failed to execute asynchronous action: Action[ id=def63211-88aa-454b-9965-112b01569532, node=null ]: 08220025 Failed to perform ImageMagick transformation:
Execution result:
   os:         Windows 8
   command:    C:\Alfresco\imagemagick\convert.exe C:\Alfresco\tomcat\temp\Alfresco\ImageMagickContentTransformerWorker_source_6382092538004036170.pdf[0] -auto-orient -resize "100x100>" C:\Alfresco\tomcat\temp\Alfresco\ImageMagickContentTransformerWorker_target_1358940930317867262.png
   succeeded:  false
   exit code:  1
   out:       
   err:        convert.exe: Postscript delegate failed `C:\Alfresco\tomcat\temp\Alfresco\ImageMagickContentTransformerWorker_source_6382092538004036170.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/682.
convert.exe: no images defined `C:\Alfresco\tomc
org.alfresco.error.AlfrescoRuntimeException: 08220033 Creation of thumbnail 'doclib' failed
   at org.alfresco.repo.thumbnail.CreateThumbnailActionExecuter.executeImpl(CreateThumbnailActionExecuter.java:202)
   at org.alfresco.repo.action.executer.ActionExecuterAbstractBase.execute(ActionExecuterAbstractBase.java:258)
   at org.alfresco.repo.action.ActionServiceImpl.directActionExecution(ActionServiceImpl.java:838)
   at org.alfresco.repo.action.ActionServiceImpl.executeActionImpl(ActionServiceImpl.java:738)
   at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1$1.execute(AsynchronousActionExecutionQueueImpl.java:428)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:452)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:323)
   at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper$1.doWork(AsynchronousActionExecutionQueueImpl.java:437)
   at org.alfresco.repo.tenant.TenantUtil.runAsWork(TenantUtil.java:119)
   at org.alfresco.repo.tenant.TenantUtil.runAsTenant(TenantUtil.java:88)
   at org.alfresco.repo.tenant.TenantUtil$1.doWork(TenantUtil.java:62)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:548)
   at org.alfresco.repo.tenant.TenantUtil.runAsUserTenant(TenantUtil.java:58)
   at org.alfresco.repo.action.AsynchronousActionExecutionQueueImpl$ActionExecutionWrapper.run(AsynchronousActionExecutionQueueImpl.java:440)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
   at java.lang.Thread.run(Thread.java:724)
Caused by: org.alfresco.service.cmr.repository.ContentIOException: 08220026 Content conversion failed:
   reader: ContentAccessor[ contentUrl=store://2014/9/22/17/12/bb9103f3-e5b5-422a-8efc-c4155302b56f.bin, mimetype=application/pdf, size=0, encoding=UTF-8, locale=en_US]
   writer: ContentAccessor[ contentUrl=store://C:\Alfresco\tomcat\temp\Alfresco\FailoverTransformer_intermediate_ProxyContentTransformer_3338081365801872048.png, mimetype=image/png, size=0, encoding=UTF-8, locale=en_US]
   options: {targetContentProperty=null, contentReaderNodeRef=workspace://SpacesStore/3ed27b86-df2d-499f-abcb-b7014bd91eb8, contentWriterNodeRef=null, imageResizeOptions=ImageResizeOptions [width=100, height=100, maintainAspectRatio=true, percentResize=false, resizeToThumbnail=false, allowEnlargement=false], use=doclib, sourceContentProperty=null, includeEmbedded=false, commandOptions=, imageAutoOrient=true}
   limits:
   at org.alfresco.repo.content.transform.AbstractContentTransformer2.transform(AbstractContentTransformer2.java:256)
   at org.alfresco.repo.content.ContentServiceImpl.failoverTransformers(ContentServiceImpl.java:679)
   at org.alfresco.repo.content.ContentServiceImpl.transform(ContentServiceImpl.java:628)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
   at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:80)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.model.ml.MLContentInterceptor.invoke(MLContentInterceptor.java:125)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.alfresco.repo.audit.AuditMethodInterceptor.proceedWithAudit(AuditMethodInterceptor.java:247)
   at org.alfresco.repo.audit.AuditMethodInterceptor.proceed(AuditMethodInterceptor.java:213)
   at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:166)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at com.sun.proxy.$Proxy48.transform(Unknown Source)
   at org.alfresco.repo.rendition.executer.AbstractTransformationRenderingEngine$TransformationCallable$1.doWork(AbstractTransformationRenderingEngine.java:435)
   at org.alfresco.repo.rendition.executer.AbstractTransformationRenderingEngine$TransformationCallable$1.doWork(AbstractTransformationRenderingEngine.java:426)
   at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:548)
   at org.alfresco.repo.rendition.executer.AbstractTransformationRenderingEngine$TransformationCallable.call(AbstractTransformationRenderingEngine.java:425)
   at org.alfresco.repo.rendition.executer.AbstractTransformationRenderingEngine$TransformationCallable.call(AbstractTransformationRenderingEngine.java:403)
   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
   at java.util.concurrent.FutureTask.run(FutureTask.java:166)
   … 3 more
Caused by: org.alfresco.service.cmr.repository.ContentIOException: 08220025 Failed to perform ImageMagick transformation:
Execution result:
   os:         Windows 8
   command:    C:\Alfresco\imagemagick\convert.exe C:\Alfresco\tomcat\temp\Alfresco\ImageMagickContentTransformerWorker_source_6382092538004036170.pdf[0] -auto-orient -resize "100x100>" C:\Alfresco\tomcat\temp\Alfresco\ImageMagickContentTransformerWorker_target_1358940930317867262.png
   succeeded:  false
   exit code:  1
   out:       
   err:        convert.exe: Postscript delegate failed `C:\Alfresco\tomcat\temp\Alfresco\ImageMagickContentTransformerWorker_source_6382092538004036170.pdf': No such file or directory @ error/pdf.c/ReadPDFImage/682.
convert.exe: no images defined `C:\Alfresco\tomc
   at org.alfresco.repo.content.transform.magick.ImageMagickContentTransformerWorker.transformInternal(ImageMagickContentTransformerWorker.java:188)
   at org.alfresco.repo.content.transform.magick.AbstractImageMagickContentTransformerWorker.transform(AbstractImageMagickContentTransformerWorker.java:273)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:606)
   at org.alfresco.repo.management.subsystems.SubsystemProxyFactory$1.invoke(SubsystemProxyFactory.java:72)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at com.sun.proxy.$Proxy14.transform(Unknown Source)
   at org.alfresco.repo.content.transform.ProxyContentTransformer.transformInternal(ProxyContentTransformer.java:98)
   at org.alfresco.repo.content.transform.AbstractContentTransformer2.transform(AbstractContentTransformer2.java:211)
   … 33 more

Please give me the solution where I am wrong ,please find the attached global.properties and transformation.xml files

wayzz1992
Champ in-the-making
Champ in-the-making
Hi I've been following this post on the other thread and am asking if you can give me a small tutorial on how you have managed to achieve this. I followed every step in the other thread but I am still not getting a preview in my Alfresco Share.

It would be really helpful as it is the final task in my project.