Converting Word to PDF via internal website
-
Hi, I'm working on a solution to convert Word documents to PDFs through an internal website in C# .Net. I've used the conversion code successfully in a Windows app, but as it turns out we're not allowed to install anything on the machines where this conversion is necessary (long story). IE is available on these machines, so I thought a web-based version would work. The web page works fine when I run it through Visual Studio 2005, but when I browse to the page in IE, it won't even open the Word doc. I get this error: "System.Runtime.InteropServices.COMException: This command is not available." Here is the line of code that generates the error: "Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing); I don't really want to open the Word doc; the user will have already created it and will be uploading it to the website via the FileUpload object. The conversion program I'm currently working with is PrimoPDF. We haven't actually purchased it yet, so if someone has a better suggestion, I'm open to it. Sorry for the longwindedness and thanks for any help!
-
Hi, I'm working on a solution to convert Word documents to PDFs through an internal website in C# .Net. I've used the conversion code successfully in a Windows app, but as it turns out we're not allowed to install anything on the machines where this conversion is necessary (long story). IE is available on these machines, so I thought a web-based version would work. The web page works fine when I run it through Visual Studio 2005, but when I browse to the page in IE, it won't even open the Word doc. I get this error: "System.Runtime.InteropServices.COMException: This command is not available." Here is the line of code that generates the error: "Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing); I don't really want to open the Word doc; the user will have already created it and will be uploading it to the website via the FileUpload object. The conversion program I'm currently working with is PrimoPDF. We haven't actually purchased it yet, so if someone has a better suggestion, I'm open to it. Sorry for the longwindedness and thanks for any help!
Hi Kevin, If you haven't purchased PrimoPDF - you might be using the demo version? when you want to use the third party tool why are you making the call to open the word file? as in the line below. Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing); Generally the third party s/w providers will provide some user friendly mechanism such as below. PDFCreator.GetInstance().Convert(SrcFilePath,TargFilePath); I am using easyPDF for similar purpose, I am not sure of PrimoPDF ;P . It should be simple. I think you need to go through the document. -Ram.
-
Hi Kevin, If you haven't purchased PrimoPDF - you might be using the demo version? when you want to use the third party tool why are you making the call to open the word file? as in the line below. Microsoft.Office.Interop.Word.Document aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref missing, ref missing, ref missing); Generally the third party s/w providers will provide some user friendly mechanism such as below. PDFCreator.GetInstance().Convert(SrcFilePath,TargFilePath); I am using easyPDF for similar purpose, I am not sure of PrimoPDF ;P . It should be simple. I think you need to go through the document. -Ram.
Thanks for responding. Yes, I am using the demo. As for opening Word, that came right from the instructions. I haven't tried easyPDF, but I'll take a look at it. Are you using it on a website? Thanks again!
-
Thanks for responding. Yes, I am using the demo. As for opening Word, that came right from the instructions. I haven't tried easyPDF, but I'll take a look at it. Are you using it on a website? Thanks again!
-
Great, thanks!