Home » , » Convert A Word Doc to PDF Without using third part tool??

Convert A Word Doc to PDF Without using third part tool??

Written By M.L on செவ்வாய், 15 நவம்பர், 2011 | நவம்பர் 15, 2011

Below sample code will convert *docx file into PDF without using 3rd party tool, only you need to do is to add reference of “Microsoft.Office.Interop.Word” dll to your project [ from Add Reference > .Net Tab]. If this Office Primary Interop Assemblies are missing on your system, then kindly installed it and installations details are available on MSDN site https://ind.email.accenture.com/owa/redir.aspx?C=7819c6187c014ebb85ad1e9ccceec480&URL=http%3a%2f%2fmsdn.microsoft.com%2fen-us%2flibrary%2f15s06t57(v%3dVS.90).aspx%23pia2007

Code for converting Word Doc into PDF

Microsoft.Office.Interop.Word.Application appWord = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document wordDocument = appWord.Documents.Open("C:\\My_Word_Doc.docx");
wordDocument.ExportAsFixedFormat("DocTo.pdf", Microsoft.Office.Interop.Word.WdExportFormat.wdExportFormatPDF);

1 comments:

Popular Posts

General Category