Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Converting Word to PDF via internal website

Converting Word to PDF via internal website

Scheduled Pinned Locked Moved Web Development
csharphelpvisual-studiocomannouncement
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kevin Barrett
    wrote on last edited by
    #1

    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!

    R 1 Reply Last reply
    0
    • K Kevin Barrett

      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!

      R Offline
      R Offline
      ram1974
      wrote on last edited by
      #2

      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.

      K 1 Reply Last reply
      0
      • R ram1974

        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.

        K Offline
        K Offline
        Kevin Barrett
        wrote on last edited by
        #3

        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!

        R 1 Reply Last reply
        0
        • K Kevin Barrett

          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!

          R Offline
          R Offline
          ram1974
          wrote on last edited by
          #4

          Yes, it is a web based tool -Ram

          K 1 Reply Last reply
          0
          • R ram1974

            Yes, it is a web based tool -Ram

            K Offline
            K Offline
            Kevin Barrett
            wrote on last edited by
            #5

            Great, thanks!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups