?
Solved

Convert Word to pdf from ColdFusion

Posted on 2009-04-21
8
Medium Priority
?
1,375 Views
Last Modified: 2013-12-20
Is there a ColdFusion method of converting a Word file into pdf?  I have to merge a Word document with a pdf, and I think I need to convert the Word document first so that I can use the cfpdf command to merge the two.
0
Comment
Question by:psenn
  • 4
  • 3
8 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 24197953
Yes, you would need to convert the .doc to pdf first.  Unfortunately, there is not built in way to convert ms word documents.  You need an external tool.  I believe it can be done with LiveCycle (if you have that).  Otherwise, there are commercial tools available such as:

http://www.pdfonline.com/easypdf/sdk/faqs/using-bcl-easypdf-sdk.htm
pdf documents.  
www.aspose.com/documentation/file-format-components/aspose.pdf-for-.net...java/converting-word-documents-to-pdf.html
0
 
LVL 52

Expert Comment

by:_agx_
ID: 24198233
There are a bunch of tools out there, so a lot depends on your needs.  If it is a recurring need with a variety of complex word documents, complex, you would be better off with a commercial tool.  They tend to be more stable, but they are not free.

There are some free options like OpenOffice.  But the free options tend to have less documentation, and may not be able to handle everything you throw at them.   So you may want to take that into consideration.
0
 
LVL 36

Accepted Solution

by:
SidFishes earned 1500 total points
ID: 24198704
you can use the procedure outlined here

http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=cfobject_13.html

to convert a word document to html and just add the following

<cffile action="read" file="#expandPath('temp.htm')#" variable="fileToConvert">
      <cfdocument  overwrite="yes" filename="#expandPath('temp.pdf')#" format="PDF">
<cfoutput>#fileToConvert#</cfoutput></cfdocument>

at the end to convert the html to pdf


note: a version of word must be installed on the server for this to work (which is a bad idea on a publicly facing production server)



0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 
LVL 52

Expert Comment

by:_agx_
ID: 24198726
Yes, I was going to suggest that .. but I didn't think cfdocument understood MS Word's version of HTML.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 24198783
http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_d-e_05.html#3765835
"The cfdocument tag does not support the Internet Explorer-specific HTML generated by Microsoft Word."

Well, supposedly it doesn't.  But you may as well give it a shot, and if it works great.  If not, nothing lost.
0
 
LVL 36

Expert Comment

by:SidFishes
ID: 24198833
should edit my post... works with word 2000 (pre-mshtml)





0
 

Author Comment

by:psenn
ID: 24198892
Sid, I'm getting
ComObjectInstantiationException: An exception occurred when instantiating a COM object..

It's because it's a shared server I suppose.


<cfobject type="com" action="connect" class="Word.application" name="Application.MyWordobj" context="local">

Open in new window

0
 
LVL 36

Expert Comment

by:SidFishes
ID: 24198932
wouldn't work on a shared sever at all (unless you could convince them to install an old copy of word 200 ..hehe)

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question