Copy link to clipboard
Copied
Hello all,
I have read quite a bit on this topic and tested many with no actual solution. What I need to accomplish is to open a MS Word document using CF8 that is saved in a share and then convert to PDF (read only) and display the results to the user.
Does any one know of an actual working solution to this?
Using the code below, I have opened the Word document with out formatting.
cfscript
objWord=CreateObject("COM", "Word.Application");
objDoc = objWord.Documents;
wordDoc = objDoc.Open("test2.doc");
docRange = wordDoc.Range(0);
docText = docRange.Text;
/cfscript
cfdump var="#docText#"
cfscript
wordDoc.Close();
objWord.Quit();
/cfscript
This is unpredictable and is very slow.
The next attempt is,
cfheader name="Content-Disposition" value="inline; filename=temp.doc"
cfcontent type="application/word" file="..\Conv_PDF\NP_2.0.doc" deletefile="no"
This will open the Word doc and display in a r/w mode.
Any ideas or information will be very helpful.
Thank you
TJ
Copy link to clipboard
Copied
My first choice would be to remove ColdFusion from most or all of this work flow.
Adobe Acrobat comes with a tool called distiller. Way back, last century, when I was trying to automate a similar work flow. I was aware that you could get a distiller version that would watch a directory and anything that got dropped into that directory would get 'printed' out as a PDF file.
If such a beast still exists, I would set up so that you can just move the word doc file into that directory, CF could do that easily. Distiller (Or whatever it has become now) would print that out as a PDF to another directory where ColdFusion could easily retrive it and serve it to the user.
I hope that helps, and I would be interested in if you are able to put these pieces together. I like to try and keep current on such ideas.
Copy link to clipboard
Copied
Hi Ian,
Thanks for the idea of the Distiller watch folder.
The Word docs are part of a document storage system and are all saved as Master documents. At any time the Master documents could be changed by the documents owner. To display the pdf file at run time would reflect any changes to the document by the owner.
I will post if I find an answer.
Thanks for you input.
TJ