2 Replies Latest reply on Apr 16, 2009 1:41 PM by tej_web

    Open a Word doc, Convert to PDF and Display the PDF to the User.

    tej_web Level 1

      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.




      objWord=CreateObject("COM", "Word.Application");
      objDoc = objWord.Documents;   
      wordDoc = objDoc.Open("test2.doc");  
      docRange = wordDoc.Range(0);  
      docText = docRange.Text;




      cfdump var="#docText#"







      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



        • 1. Re: Open a Word doc, Convert to PDF and Display the PDF to the User.
          ilssac Level 5

          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.

          • 2. Re: Open a Word doc, Convert to PDF and Display the PDF to the User.
            tej_web Level 1

            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.