title: Convert of word file(.docx & doc) to .pdf using c# is not working
body: <p>I am using visualstudio 2010 and I am trying to convert word.docx file to .pdf file and is working fine in local but on run time on server it is showing error as</p>
  
  <pre><code>Could not load file or assembly 'office, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.
  </code></pre>
  
  <p>What I have tried is added reference and put in bin folder</p>
  
  <pre><code>Microsoft.Office.Interop.Word.dll
  Microsoft.Office.Interop.Word.xml
  </code></pre>
  
  <p>as shown in figure</p>
  
  <p><img src="https://i.stack.imgur.com/tRtBr.jpg" alt="enter image description here"></p>
  
  <p>my .cs code is as</p>
  
  <pre><code>Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application();
  
   wordApp.Visible = false;
  
              // file from
   object filename =Server.MapPath("word.docx"); // input
  
      // file to
   object newFileName = Server.MapPath("pdf/document_to_read_tomorrow.pdf"); // output
   object missing = System.Type.Missing;
  
              // open document
   Microsoft.Office.Interop.Word.Document doc = wordApp.Documents.Open(ref filename, ref missing, ref missing, ref missing, ref missing, ref missing,
                  ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing,
                  ref missing, ref missing, ref missing);
  
              // formt to save the file, this case PDF
   object formatoArquivo = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF;
  
              // changes in paper size
  
   doc.PageSetup.PaperSize = Microsoft.Office.Interop.Word.WdPaperSize.wdPaperA4;
  
              // changes orietation paper
   doc.PageSetup.Orientation = Microsoft.Office.Interop.Word.WdOrientation.wdOrientPortrait;
  
              // other changes
   doc.PageSetup.LeftMargin = 20;
   doc.PageSetup.RightMargin = 0;
  
  
              // save file
   doc.SaveAs(ref newFileName, ref formatoArquivo, ref missing, ref missing, ref missing, ref missing, ref missing,
                  ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
  
   doc.Close(ref missing, ref missing, ref missing);
  
   wordApp.Quit(ref missing, ref missing, ref missing);
  </code></pre>
  
  <p>My WebConfig seems as </p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
  &lt;connectionStrings&gt;
      &lt;add name="xyz" connectionString="Data Source=xyz;Initial Catalog=xyz;Persist Security Info=True;User ID=xyz;Password=xyz" providerName="System.Data.SqlClient"/&gt;
  &lt;/connectionStrings&gt;
  &lt;system.web&gt;
      &lt;httpHandlers&gt;
          &lt;add verb="GET" path="CaptchaImage.axd" type="MSCaptcha.CaptchaImageHandler, MSCaptcha"/&gt;
          &lt;add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/&gt;
      &lt;/httpHandlers&gt;
      &lt;compilation debug="true" targetFramework="4.0"&gt;
          &lt;assemblies&gt;
              &lt;add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/&gt;
              &lt;add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/&gt;
              &lt;add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/&gt;
              &lt;add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/&gt;
              &lt;add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/&gt;
              &lt;add assembly="Microsoft.Office.Interop.Word, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/&gt;&lt;/assemblies&gt;
          &lt;buildProviders&gt;
              &lt;add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/&gt;
          &lt;/buildProviders&gt;
      &lt;/compilation&gt;
      &lt;customErrors mode="Off"&gt;
      &lt;/customErrors&gt;
      &lt;sessionState timeout="720"&gt;
      &lt;/sessionState&gt;
      &lt;pages enableViewStateMac="false"/&gt;
  &lt;/system.web&gt;
  &lt;system.webServer&gt;
      &lt;defaultDocument&gt;
          &lt;files&gt;
              &lt;clear/&gt;
              &lt;add value="default.aspx"/&gt;
          &lt;/files&gt;
      &lt;/defaultDocument&gt;
      &lt;validation validateIntegratedModeConfiguration="false"/&gt;
      &lt;handlers&gt;
          &lt;add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/&gt;
      &lt;/handlers&gt;
  &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>