Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to convert a Microsoft Word document to PDF with ColdFusion?

The above question says it all. I know you can create a PDF from an image file or HTML in ColdFusion 8 using CFPDF, but I'm wondering if it's possible to create a PDF from a MS Word document directly - in CF8 or CF9.

Could you import the Word document and convert it to HTML or an image file, and then do the conversion? Or is there a shortcut?

like image 624
Eric Belair Avatar asked Feb 18 '10 21:02

Eric Belair


2 Answers

see Doc: Office file interoperability - Using cfdocument

ColdFusion 9 supports OpenOffice, which uses the cfdocument tag to convert a Word document (.doc format) to PDF.

<cfdocument 
    format="pdf" 
    srcfile="C:\documents\MyDocument.doc" 
    filename="C:\documents\MyDocument.pdf"> 
</cfdocument>
like image 160
Henry Avatar answered Sep 18 '22 07:09

Henry


In CF8, you could probably do something with COM object integration or POI integration, but it would not be simple/straightforward.

Converting it to HTML using Word's save as feature is probably the simplest route using CF8. I'll suggest that Henry has the right idea, though, upgrading to CF9 to take advantage of OO.O integration.

Edit: Thanks to @jarofclay, I now know that the POI CFC wrapper has been updated to include Word docs. I remembered it only supporting Excel, but that's clearly changed. Um, is it too late for me to change my vote for how to do this in CF8?

like image 34
Ben Doom Avatar answered Sep 17 '22 07:09

Ben Doom