Convert word doc to pdf<P>Hi,</P> <P>&nbsp;I need to convert word document to pdf file using C#.2</P> <P>&nbsp;Iam having </P> <OL> <LI>MS visual studio 2005 professional (and also MS VS.2003 enterprise ed)</LI> <LI>MS Office 2007</LI> <LI>I have downloaded SaveAsPDFandXPS (used to convert&nbsp;doc to pdf)</LI> <LI>Microsoft Visual Studio 2005 Tools for Office Second Edition Runtime (VSTO 2005 SE)</LI></OL> <P>My question is</P> <P>Do i need "MS visual studio 2005 for office tools" version to work with ms word, so that i can convert word to pdf.&nbsp;</P> <P>&nbsp;</P>© 2009 Microsoft Corporation. All rights reserved.Wed, 07 Oct 2009 18:21:15 Zf8989c05-d04a-4b4a-be0f-fc0055691de7http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#f8989c05-d04a-4b4a-be0f-fc0055691de7http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#f8989c05-d04a-4b4a-be0f-fc0055691de7mrleokarthikhttp://social.msdn.microsoft.com/Profile/en-US/?user=mrleokarthikConvert word doc to pdf<P>Hi,</P> <P>&nbsp;I need to convert word document to pdf file using C#.2</P> <P>&nbsp;Iam having </P> <OL> <LI>MS visual studio 2005 professional (and also MS VS.2003 enterprise ed)</LI> <LI>MS Office 2007</LI> <LI>I have downloaded SaveAsPDFandXPS (used to convert&nbsp;doc to pdf)</LI> <LI>Microsoft Visual Studio 2005 Tools for Office Second Edition Runtime (VSTO 2005 SE)</LI></OL> <P>My question is</P> <P>Do i need "MS visual studio 2005 for office tools" version to work with ms word, so that i can convert word to pdf.&nbsp;</P> <P>&nbsp;</P>Wed, 10 Jan 2007 11:51:43 Z2008-02-15T08:13:24Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#f62fc7a1-3064-4b41-9f4d-652ccc516b87http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#f62fc7a1-3064-4b41-9f4d-652ccc516b87Cindy Meisterhttp://social.msdn.microsoft.com/Profile/en-US/?user=Cindy%20MeisterConvert word doc to pdf<p>Hi Chennai</p> <p>No, VSTO is not required to work automate the Word application. I've never tried it, but I'm told the <font face=Arial size=2>ExportAsFixedFormat </font>method should convert a Word 2007 document to pdf.</p> <p>If by &quot;list out the namespaces required to work with the document&quot; you mean the Help for the object model: The best way to access this is to start Word, press Alt+F11 to go into its IDE, then use the Help menu. This will take you to an online source.</p> <p>You can also press F2 in the IDE to bring up its object browser.</p>Wed, 10 Jan 2007 17:20:29 Z2007-01-10T17:20:29Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#fc905301-a0fc-4ec9-b5ac-e919b63d16a3http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#fc905301-a0fc-4ec9-b5ac-e919b63d16a3mrleokarthikhttp://social.msdn.microsoft.com/Profile/en-US/?user=mrleokarthikConvert word doc to pdf<p>hello everybody</p> <p>I myself find out answer for this</p> <p>Add reference to MS.Word</p><font size=2> <p></font><font color="#0000ff" size=2>  private Microsoft.Office.Interop.Word.ApplicationClass MSdoc;        <br>        <br>        //Use for the parameter whose type are not known or say Missing<br>        object Unknown = Type.Missing;</font></p> <p><font color="#0000ff" size=2>  private void word2PDF(object Source, object Target)<br>        {</font><font color="#0000ff" size=2>   //Creating the instance of Word Application           <br>       if (MSdoc == null)MSdoc = new Microsoft.Office.Interop.Word.ApplicationClass();<br>            <br>            try<br>            {   <br>                MSdoc.Visible = false;                <br>                MSdoc.Documents.Open(ref Source, ref Unknown,<br>                     ref Unknown, ref Unknown, ref Unknown,<br>                     ref Unknown, ref Unknown, ref Unknown,<br>                     ref Unknown, ref Unknown, ref Unknown,<br>                     ref Unknown, ref Unknown, ref Unknown, ref Unknown, ref Unknown);<br>                MSdoc.Application.Visible = false; <br>                MSdoc.WindowState = Microsoft.Office.Interop.Word.WdWindowState.wdWindowStateMinimize;                <br>                                                <br>                object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF;<br>                                <br>                MSdoc.ActiveDocument.SaveAs(ref Target, ref format,<br>                        ref Unknown, ref Unknown, ref Unknown,<br>                        ref Unknown, ref Unknown, ref Unknown,<br>                        ref Unknown, ref Unknown, ref Unknown,<br>                        ref Unknown, ref Unknown, ref Unknown,<br>                       ref Unknown, ref Unknown);</font><font color="#0000ff" size=2><br>            }<br>            catch (Exception e)<br>            {<br>                MessageBox.Show(e.Message);<br>            }<br>            finally<br>            {<br>                if (MSdoc != null)<br>                {<br>                    MSdoc.Documents.Close(ref Unknown, ref Unknown, ref Unknown);<br>                    //WordDoc.Application.Quit(ref Unknown, ref Unknown, ref Unknown); <br>                }                <br>                // for closing the application<br>                WordDoc.Quit(ref Unknown, ref Unknown, ref Unknown);<br>            }<br>        }</font></p> <p> </p> <p>Prerequisite:</p> <p>MS word2007 with (<strong><u>Primary Interoperability assembly</u></strong>  will be installed by default).</p> <p>plugin SaveAsPDFandXPS (free from MS Site)</p> <p> </p> <p>Karthik</p>Fri, 12 Jan 2007 11:26:37 Z2007-01-12T11:27:25Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#c7f4e982-7445-4627-928a-12769cf84daahttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#c7f4e982-7445-4627-928a-12769cf84daaAmrJxhttp://social.msdn.microsoft.com/Profile/en-US/?user=AmrJxConvert word doc to pdf<p><font color="#3366ff">hello</font></p> <p><font color="#3366ff">i like what you written it much much close to my style.</font></p> <p><font color="#3366ff">but where can i find <font size=2>Microsoft.Office.Interop.Word.WdSaveFormat<strong><font size=4>.<font color="#ff0000">wdFormatPDF</font></font></strong>;</font></font></p> <p><font color="#3366ff" size=2>it's not there how can i add it.</font></p> <p><font color="#3366ff"><font size=2>kindly can you describe it very clearly</font><br></font></p> <p><font color="#3366ff"> </font></p> <p><font color="#3366ff">Yours</font></p> <p><font color="#3366ff">A/\/\RJX</font></p>Sun, 14 Jan 2007 11:51:49 Z2007-01-14T11:51:49Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#d1df1beb-4cd3-4a2b-b61b-89cd1d7e0db1http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#d1df1beb-4cd3-4a2b-b61b-89cd1d7e0db1mrleokarthikhttp://social.msdn.microsoft.com/Profile/en-US/?user=mrleokarthikConvert word doc to pdf<P>&nbsp;</P> <P>Make sure you have reference to Word.12. </P> <P>It will automatically add Microsoft.Office.interop.word to your reference. Follow these&nbsp; for other office application.</P> <P>(Note: you should have installed <STRONG><U>VS 2005 Tools for Office 2nd Ed. Runtime (VSTO 2005 SE) (x86)</U></STRONG></P> <P>For PDF conversion Plugin- <STRONG><U>SaveAsPDFandXPS)</U></STRONG></P> <P><STRONG><U>PDF conversion only works with Lastest MS Office 2007 only</U></STRONG></P> <P>&nbsp;</P>Wed, 17 Jan 2007 07:47:22 Z2007-01-17T07:47:22Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#bf786af1-bbf9-4f7c-b4a2-58579de55464http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#bf786af1-bbf9-4f7c-b4a2-58579de55464My Ruf Accounthttp://social.msdn.microsoft.com/Profile/en-US/?user=My%20Ruf%20AccountConvert word doc to pdfHello Friends,<br><br>Have you some stable solution to convert Word to Pdf.<br>You r talking about VS2005 has one dll for that or class for that.<br><br>But what for VS2003.<br>Have you some solution for that, Have you got dll file for that.<br><br>Also please can you find out that the dll used in VS2005 (which you use) is also usable for VS2003.<br>and working Ok!!.<br><br>If you got some other dll or any solution please reply.<br><br><br>Sat, 20 Jan 2007 07:36:49 Z2007-01-20T07:36:49Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#b5a3b4a7-7020-4eb6-9f11-4ee45040278chttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#b5a3b4a7-7020-4eb6-9f11-4ee45040278cCindy Meisterhttp://social.msdn.microsoft.com/Profile/en-US/?user=Cindy%20MeisterConvert word doc to pdf<p>Hi &quot;My Ruf Account&quot;</p> <p>There is no VSTO interface for VS 2003 that you can use with Office 2007. The dll discussed above is VS 2005, only. The most you could do with VS 2003 is to automate Word 2007 from, for example, a Windows Forms application.</p>Sun, 21 Jan 2007 06:43:42 Z2008-02-15T08:13:24Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#3aa7d7a0-8bca-45b8-8425-9e713df022ffhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#3aa7d7a0-8bca-45b8-8425-9e713df022ffMy Ruf Accounthttp://social.msdn.microsoft.com/Profile/en-US/?user=My%20Ruf%20AccountConvert word doc to pdfHello Friends,<br><br>First of all Thanks for Reply.<br>Now the issue is, <br>I want to this for my web project...<br>here We uses VS2003.<br>So Is there any alternative Solution for that?....<br><br>Please If You have some idea then Reply....<br>Mon, 22 Jan 2007 08:31:52 Z2007-01-22T08:31:52Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#91760941-4364-4a39-878d-71d3a0d617achttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#91760941-4364-4a39-878d-71d3a0d617acCindy Meisterhttp://social.msdn.microsoft.com/Profile/en-US/?user=Cindy%20MeisterConvert word doc to pdf<p>If you're targeting Office 2003, then make sure the documents are saved in Word 2003 XML file format. You can then transform the result to the PDF XML format. There are already third-party solutions available; searching the Internet should turn them up.</p> <p>This approach is really the only viable one for a server- or web-interface as it doesn't involve running the Word application.</p>Mon, 22 Jan 2007 19:13:10 Z2007-01-22T19:13:10Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#52b441e1-e40b-44dc-951b-0c0bd677fd6dhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#52b441e1-e40b-44dc-951b-0c0bd677fd6dneeleshkhttp://social.msdn.microsoft.com/Profile/en-US/?user=neeleshkConvert word doc to pdf<font face=Verdana> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'">Hi Friends</span><span style="font-size:11pt;font-family:'Calibri','sans-serif'">,</span></p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'"></span> </p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'">I am also coverting word document into pdf and I am having Office 2007 and MS visual studio 2005</span></p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'">I did the same as Karthik have mensioned above. But it gives me a exception below.</span></p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'"></span> </p> <p><span style="font-size:11pt;color:#4f81bd;font-family:'Calibri','sans-serif'">System.Runtime.InteropServices.COMException (0x800A1066): Command failed </span></p> <p><span style="font-size:11pt;color:#4f81bd;font-family:'Calibri','sans-serif'"><span>   </span>at Microsoft.Office.Interop.Word.DocumentClass.SaveAs(Object&amp; FileName, Objec</span></p> <p><span style="font-size:11pt;color:#4f81bd;font-family:'Calibri','sans-serif'">t&amp; FileFormat, Object&amp; LockComments, Object&amp; Password, Object&amp; AddToRecentFiles,</span></p> <p><span style="font-size:11pt;color:#4f81bd;font-family:'Calibri','sans-serif'"><span> </span>Object&amp; WritePassword, Object&amp; ReadOnlyRecommended, Object&amp; EmbedTrueTypeFonts,</span></p> <p><span style="font-size:11pt;color:#4f81bd;font-family:'Calibri','sans-serif'"><span> </span>Object&amp; SaveNativePictureFormat, Object&amp; SaveFormsData, Object&amp; SaveAsAOCELette</span></p> <p><span style="font-size:11pt;color:#4f81bd;font-family:'Calibri','sans-serif'">r, Object&amp; Encoding, Object&amp; InsertLineBreaks, Object&amp; AllowSubstitutions, Objec</span></p> <p><span style="font-size:11pt;color:#4f81bd;font-family:'Calibri','sans-serif'">t&amp; LineEnding, Object&amp; AddBiDiMarks)</span></p> <p><span style="font-size:11pt;color:#4f81bd;font-family:'Calibri','sans-serif'"><span>   </span>at ConsoleApplication2.Program.Main(String[] args) in C:\Documents and Settin</span></p> <p><span style="font-size:11pt;color:#4f81bd;font-family:'Calibri','sans-serif'">gs\neeleshk\Desktop\test11\ConsoleApplication2\ConsoleApplication2\Program.cs:li</span></p> <p><span style="font-size:11pt;color:#4f81bd;font-family:'Calibri','sans-serif'">ne 3</span></p> <p></font> </p>Sat, 13 Oct 2007 12:44:49 Z2007-10-13T12:44:49Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#d5330d06-08bd-4083-9bfc-302fa06801b4http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#d5330d06-08bd-4083-9bfc-302fa06801b4Cindy Meisterhttp://social.msdn.microsoft.com/Profile/en-US/?user=Cindy%20MeisterConvert word doc to pdfThe PDF file converter is not installed as part of Office, due to licensing issues raised by Adobe. It must be downloaded and installed separately. Are you sure the file converter is correctly installed on the machine where this error is being raised? <p align=left><font face=Arial size=2></font> </p>Sat, 13 Oct 2007 17:59:11 Z2007-10-13T17:59:11Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#46ae27a0-709c-4f46-8216-0543ac9ee11ehttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#46ae27a0-709c-4f46-8216-0543ac9ee11eneeleshkhttp://social.msdn.microsoft.com/Profile/en-US/?user=neeleshkConvert word doc to pdf<p><span style="font-size:11pt;font-family:'Calibri','sans-serif'">Hi Cindy,</span></p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'"> </span></p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'">I am not using any kind of PDF file convertor rather i am trying to do this with C# code. and that code convert .doc to .rtf &amp; .html without any error. and when i am trying it for PDF then it gives me exception like </span></p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'">&quot;<span style="color:#215868">The remote procedure call failed and did not execute. (Exception from HRESULT: 0x800706BF)&quot;</span></span></p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'"> </span></p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'">My steps are</span></p> <p style="margin-left:0.75in;text-indent:-0.25in"><span style="font-size:11pt;font-family:'Calibri','sans-serif'"><span style="">-<span style="font:7pt 'Times New Roman'">          </span></span></span><span style="font-size:11pt;font-family:'Calibri','sans-serif'">First I have converted<span style="">  </span>.doc to .rtf (converted successfully).</span></p> <p style="margin-left:0.75in;text-indent:-0.25in"><span style="font-size:11pt;font-family:'Calibri','sans-serif'"><span style="">-<span style="font:7pt 'Times New Roman'">          </span></span></span><span style="font-size:11pt;font-family:'Calibri','sans-serif'">Then I have tried .rtf to .pdf (gives exception as messioned above) and I have also tried to convert .doc to .pdf then it give me exceptions.</span></p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'"> </span></p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'">Thanks,</span></p> <p><span style="font-size:11pt;font-family:'Calibri','sans-serif'">Neelesh</span></p> <p> <p align=left><font face=Arial size=2></font> </p> <p></p>Mon, 15 Oct 2007 08:45:28 Z2007-10-15T08:45:28Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#f2e49594-6064-45e9-8468-cc8c8c13d328http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#f2e49594-6064-45e9-8468-cc8c8c13d328Cindy Meisterhttp://social.msdn.microsoft.com/Profile/en-US/?user=Cindy%20MeisterConvert word doc to pdf<p>Hi Neelesh</p> <p align=left> </p> <p align=left>When Word saves a document to <em>any</em> file format other than its native *.doc format, it uses a file converter. This is true for RTF, for HTML, or for saving as plain text (just as examples). The difference between these file formats and PDF is that their file converters are installed by default when Office is installed. The PDF file converter is <em>not</em> part of the Office package. Originally, it was supposed to be, but Adobe threatened a lawsuit.</p> <p align=left> </p> <p align=left>Therefore, the PDF file converter <em>must</em> be downloaded and installed separately before you can use it. It doesn't matter whether you're automating Office or working as an end-user.</p> <p align=left><font face=Arial size=2></font> </p>Mon, 15 Oct 2007 14:48:16 Z2007-10-15T14:48:16Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#a61ac9da-717b-40a0-9831-7cb2cdc1e929http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#a61ac9da-717b-40a0-9831-7cb2cdc1e929manzanahttp://social.msdn.microsoft.com/Profile/en-US/?user=manzanaConvert word doc to pdf<p align=left><font face=Arial size=2></font> </p> <p>I installed office 2003 on server and client, and use <font size=2>Microsoft.Office.Interop.Word to handle word by C#.But I can't start word on client.I'm not sure what's wrong with my codes? They just like:</font></p><font size=2> <p>m_appWord = </font><font color="#0000ff" size=2>new</font><font size=2> Microsoft.Office.Interop.Word.</font><font color="#008080" size=2>Application</font><font size=2>();</p> <p>m_appWord.Visible = </font><font color="#0000ff" size=2>true</font><font size=2>;</p> <p>m_appWord.DisplayAlerts = </font><font color="#008080" size=2>WdAlertLevel</font><font size=2>.wdAlertsNone;</p> <p>m_bStartupApp = </font><font color="#0000ff" size=2>true</font><font size=2>;</p> <p>bResult = </font><font color="#0000ff" size=2>true</font><font size=2>;</p> <p> </p> <p align=left>and so on...</p> <p align=left>Please give me your suggestions.</p> <p align=left>Thanks a lot</font></p>Thu, 27 Dec 2007 03:50:41 Z2007-12-27T03:50:41Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#fbf0be16-4618-40ec-af3d-62ba06527b57http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#fbf0be16-4618-40ec-af3d-62ba06527b57imatworknowhttp://social.msdn.microsoft.com/Profile/en-US/?user=imatworknowConvert word doc to pdfCould you give some insight on how to call this?<br><br>i.e.  Should this work?  <span><span id="_ctl0_MainContent__ctl0_PostForm_ReplyBody"><font color="#0000ff" size=2>word2PDF(&quot;filename.doc&quot;, &quot;filename.pdf&quot;);<br><br>Thank you.<br></font></span></span>Thu, 14 Feb 2008 21:59:13 Z2008-02-14T21:59:13Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#4e7a7bc4-b6e8-4198-8dcc-1132aee97c5dhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#4e7a7bc4-b6e8-4198-8dcc-1132aee97c5dTim Ferrohttp://social.msdn.microsoft.com/Profile/en-US/?user=Tim%20FerroConvert word doc to pdfThanks for the help so far but I am getting an error when I call the line of code to save the file as pdf.<br>The error says that the application is busy. Any thoughts?<br><br>{&quot;The message filter indicated that the application is busy. (Exception from HRESULT: 0x8001010A (RPC_E_SERVERCALL_RETRYLATER))&quot;}<br>Fri, 07 Mar 2008 21:52:30 Z2008-03-07T21:52:30Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#ef7984f5-5d21-4be6-8cee-feac7d080e76http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#ef7984f5-5d21-4be6-8cee-feac7d080e76LarryOliverhttp://social.msdn.microsoft.com/Profile/en-US/?user=LarryOliverConvert word doc to pdfHi Guys!<br><br>I advice you to try the PDF Metamorphosis .Net, it able to convert RTF to PDF:<br><a title="http://www.sautinsoft.com/components/pdf_metamorphosis_net.zip" href="http://www.sautinsoft.com/components/pdf_metamorphosis_net.zip">http://www.sautinsoft.com/components/pdf_metamorphosis_net.zip</a><br><br>So, at first you may convert DOC to RTF by MS Office and next RTF to PDF by Metamorphosis.<br><br>This is a sample code on VB.Net:<br><br>Dim p As New SautinSoft.PdfMetamorphosis<br>p.RtfToPdfConvertFile(&quot;D:\Example.rtf&quot;, &quot;D:\File.pdf&quot;)<br><br><br>C# sample:<br><br>SautinSoft.PdfMetamorphosis p = new SautinSoft.PdfMetamorphosis();<br>p.RtfToPdfConvertFile(&quot;D:\Example.rtf&quot;, &quot;D:\File.pdf&quot;);<br><br><br>Best wishes,<br>Max<br><br>Wed, 19 Mar 2008 12:12:07 Z2008-03-19T12:12:07Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#605a2b0e-8ee6-41af-908c-4f7fe65cbb37http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#605a2b0e-8ee6-41af-908c-4f7fe65cbb37AlbertLianghttp://social.msdn.microsoft.com/Profile/en-US/?user=AlbertLiangConvert word doc to pdf<p align=left><font face=Arial size=2>Not sure if this helps anyone but I recently had to convert Word 2003 docs to pdf. You basically print the document out as a postscript file, then take that file and run it through Adobe Acrobat Distiller.</font></p> <p> </p> <p align=left>added a reference to COM lib &quot;ACRODISTXLib&quot; which is the Adobe Acrobat Distiller. </p> <p> </p><font color="#0000ff" size=2> <p>private</font><font size=2> Word.</font><font color="#2b91af" size=2>Document</font><font size=2> _myWordDoc;</p> <p></font><font color="#0000ff" size=2>private</font><font size=2> Word.</font><font color="#2b91af" size=2>Application</font><font size=2> _myWordApp;</font></p><font color="#0000ff" size=2> <p>private</font><font size=2> </font><font color="#0000ff" size=2>string</font><font size=2> filename_template = &quot;C:\\doc1.doc&quot;;</p></font><font size=2><font color="#0000ff" size=2> <p>private<font color="#000000" size=2> </font>object</font><font size=2> filename_obj = (</font><font color="#0000ff" size=2>object</font><font size=2>)filename_template;</font></p> <p align=left><font size=2></font> </p><font size=2><font color="#0000ff" size=2> <p>private</font><font size=2> </font><font color="#0000ff" size=2>object</font><font size=2> missing = System.Reflection.</font><font color="#2b91af" size=2>Missing</font><font size=2>.Value; </font><font color="#008000" size=2>// our 'void' value</font></p><font color="#008000" size=2><font color="#0000ff" size=2> <p>private object</font><font color="#000000" size=2> printrange_obj = Word.</font><font color="#2b91af" size=2>WdPrintOutPages</font><font size=2><font color="#000000">.wdPrintAllPages;</font></p></font></font><font size=2> <p></font><font color="#0000ff" size=2>private</font><font size=2> </font><font color="#0000ff" size=2>object</font><font size=2> true_obj = </font><font color="#0000ff" size=2>true</font><font size=2>;</p></font></font></font><font size=2> <p> </p> <p align=left>...</p> <p align=left> </p> <p align=left>_myWordDoc= _myWordApp.Documents.Open( </font><font color="#008000" size=2>// load the template into a document workspace</p></font><font size=2> <p></font><font color="#0000ff" size=2>ref</font><font size=2> filename_obj, </font><font color="#008000" size=2>// and reference it through our myWordDoc</p></font><font size=2> <p></font><font color="#0000ff" size=2>ref</font><font size=2> missing,</p> <p></font><font color="#0000ff" size=2>ref</font><font size=2> true_obj, </font><font color="#008000" size=2>// ReadOnly</p></font><font size=2> <p></font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing);</p></font><font color="#008000" size=2> <p> </p><font color="#0000ff" size=2> <p>string</font><font color="#000000" size=2> destination_ps = &quot;C:\\doc1.ps&quot;</font><font size=2><font color="#000000">;</font></p></font><font color="#0000ff" size=2><font color="#0000ff" size=2><font color="#0000ff" size=2> <p>object</font><font size=2><font color="#000000"> destination_ps_obj = destination_ps;</font></p> <p></font></font><font size=2></font><font color="#0000ff" size=2>string</font><font size=2> <font size=2><font size=2>destination_doc</font></font> = &quot;C:\\doc1.pdf&quot;;</font><font size=2></p></font></font> <p align=left> </p> <p align=left>//save as pdf</p></font><font size=2> <p>_myWordDoc.PrintOut(</font><font color="#0000ff" size=2>ref</font><font size=2> false_obj, </font><font color="#0000ff" size=2>ref</font><font size=2> printrange_obj, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> destination_ps_obj,</p> <p></font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> true_obj, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing, </font><font color="#0000ff" size=2>ref</font><font size=2> missing);</font></p> <p align=left><font size=2></font> </p><font size=2><font color="#2b91af" size=2> <p>PdfDistillerClass</font><font size=2> distiller = </font><font color="#0000ff" size=2>new</font><font size=2> </font><font color="#2b91af" size=2>PdfDistillerClass</font><font size=2>();</p></font> <p>distiller.FileToPDF(destination_ps, destination_pdf, </font><font color="#a31515" size=2>&quot;&quot;</font><font size=2>);</p></font>Tue, 12 Aug 2008 19:27:55 Z2008-08-12T19:27:55Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#cf6e7bd0-4fed-4039-80a1-d72d4fd538e8http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#cf6e7bd0-4fed-4039-80a1-d72d4fd538e8fgozarhttp://social.msdn.microsoft.com/Profile/en-US/?user=fgozarConvert word doc to pdf<p>Hi all, <br>great post.</p> <p>I write my console application and it work fine on Xp and Vista.</p> <p><br>I also try to include this code in  a windows services application but it work fine in Xp and NOT in Vista.</p> <p align=left> </p> <p>I try to go in debug mode and to analize object after &quot;open&quot; method, first to define assign document format:</p> <p align=left><br> </p> <p></p> <div class=codecontent> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div><font color="#008000" size=2><font color="#008000" size=2> <p></font></font><font color="#008000" size=2><font color="#008000" size=2> </p></font></font><font size=2> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>object</font></font><font size=2> Unknown = </font><font color="#2b91af" size=2><font color="#2b91af" size=2>Type</font></font><font size=2>.Missing;</p></font><font size=2> <p><font color="#0000ff"></font> </p></font><font size=2> <p>Word.</font><font color="#2b91af" size=2><font color="#2b91af" size=2>Document</font></font><font size=2> ObjDoc = newApp.Documents.Open(</font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> _Sources, </font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown,</p> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown, </font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown, </font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown,</p> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown, </font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown, </font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown,</p> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown, </font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown, </font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown,</p> <p></font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown, </font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown, </font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown, </font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown, </font><font color="#0000ff" size=2><font color="#0000ff" size=2>ref</font></font><font size=2> Unknown);</p> <p></p> <p></font><font color="#008000" size=2><font color="#008000" size=2></font></font> </p> <p align=left><font color="#008000" size=2><font color="#008000" size=2>// Specifying the format in which you want the output file </p></font></font><font size=2> <p></font><font color="#ffff99"><font color="#0000ff"><font color="#ff0000"><font size=2><font size=2>object</font></font><font size=2> format = Word.</font><font size=2><font size=2>WdSaveFormat</font></font><font size=2>.wdFormatPDF;</p></font></font></font></font> <p align=left> </p></div> <p align=left> </p> <p></p>It seam me: <p align=left> <div class=codeseg> <div class=codesniptitle><span style="width:100%">Code Snippet</span></div> <div class=codecontent align=left>&quot;Il comando non è disponibile perché non c'è alcun documentoaperto&quot; System.Runtime.InteropServices.ExternalException {System.Runtime.InteropServices.COMException}<br><br><br>&quot;Command not avaible because there isn't open document&quot; System.Runtime.InteropServices.ExternalException {System.Runtime.InteropServices.COMException}<br><br></div> <p class=codecontent align=left> </p></div> <p align=left>ErrorCode -2146824040 <br><br><br>There is someone that say me because on Vista it work as console application and not as windows services?</p> <p align=left>thank's<br><br></p>Wed, 17 Sep 2008 14:21:41 Z2008-09-17T14:21:41Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#681164bf-a9fe-4d73-805c-b81208d97041http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#681164bf-a9fe-4d73-805c-b81208d97041Robert Taylorhttp://social.msdn.microsoft.com/Profile/en-US/?user=Robert%20TaylorConvert word doc to pdfYou need to install the word converter. If you load Word, click 'SaveAs' and see an option to save  as XPS then you're ok. For Word 2007 go to this link...<br><br> <a href="http://www.microsoft.com/downloads/thankyou.aspx?familyId=4d951911-3e7e-4ae6-b059-a2e79ed87041&amp;displayLang=en">http://www.microsoft.com/downloads/thankyou.aspx?familyId=4d951911-3e7e-4ae6-b059-a2e79ed87041&amp;displayLang=en</a><hr class="sig">RobertFri, 06 Mar 2009 17:36:56 Z2009-03-06T17:36:56Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#9293983b-af7b-4347-9833-233e9d8f0cedhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#9293983b-af7b-4347-9833-233e9d8f0cedMurali DotNet Developerhttp://social.msdn.microsoft.com/Profile/en-US/?user=Murali%20DotNet%20DeveloperConvert word doc to pdfThanks Robert, your solution helped me.Sat, 04 Apr 2009 18:19:15 Z2009-04-04T18:19:15Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#a0af587f-11b0-4fe9-b760-c3b109e9a8fbhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#a0af587f-11b0-4fe9-b760-c3b109e9a8fbKareem Kokihttp://social.msdn.microsoft.com/Profile/en-US/?user=Kareem%20KokiConvert word doc to pdf<p>i appeared to me message say <strong>value out of range?<br/><br/>what i do in this  message?</strong></p>Tue, 14 Jul 2009 14:37:40 Z2009-07-14T14:42:02Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#bc812d06-8707-4cd8-abf8-6d230a6d18b2http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#bc812d06-8707-4cd8-abf8-6d230a6d18b2Kareem Kokihttp://social.msdn.microsoft.com/Profile/en-US/?user=Kareem%20KokiConvert word doc to pdf<p>Hi &quot;My Ruf Account&quot; ?<br/><br/>I get message for this code and say <strong>value Out of range</strong> ?<br/><br/>What do i do in this message ?<br/><br/>replay to me  fast ?</p>Tue, 14 Jul 2009 14:46:12 Z2009-07-14T14:46:12Zhttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#ff4d2e06-fa19-4e0f-9af0-d3888a893a6ahttp://social.msdn.microsoft.com/Forums/en-US/vsto/thread/f8989c05-d04a-4b4a-be0f-fc0055691de7#ff4d2e06-fa19-4e0f-9af0-d3888a893a6aRodrigo Romano - CanalSharePoint.com.brhttp://social.msdn.microsoft.com/Profile/en-US/?user=Rodrigo%20Romano%20-%20CanalSharePoint.com.brConvert word doc to pdfSegue link para gerar PDF utilizando C# e VSTO,<br /><a href="http://rodrigo-romano.spaces.live.com/blog/cns!9E20A90BA8FC57D3!280.entry"><br /><span style="color: #0033cc;">http://rodrigo-romano.spaces.live.com/blog/cns!9E20A90BA8FC57D3!280.entry</span></a><br /><br /><br /><br /><br /><br /><br /><br /><br /><strong>Rodrigo Alves Romano</strong><br />New Cocnept - Solu&ccedil;&otilde;es Inovadoras<br />http://www.nconcept.net<br />Blog T&eacute;cnico: http://rodrigo-romano.spaces.live.com<br />Wed, 07 Oct 2009 18:21:14 Z2009-10-07T18:21:14Z