Microsoft.Office.Interop.Word.Application msWordDoc = null;
Microsoft.Office.Interop.Word.Document doc = null;
doc = msWordDoc.Documents.Open(ref originalDocPath, ref oMissing, true,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing,ref oMissing, ref oMissing, ref oMissing,
ref oMissing);
ref oMissing,ref oMissing, ref oMissing, ref oMissing,
ref oMissing);
doc.SaveAs(ref pdfPath,ref fileFormat, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing,
ref oMissing, ref oMissing, ref oMissing, ref oMissing);
But this code doesn't convert big files.
But this code doesn't convert big files.


Alex SmithRank #4,089 · 366 reputationPosted Apr 24, 2015, 12:41 AM EDT
using System;
using Spire.Doc;
using Spire.Doc.Documents;
namespace DoctoPDF
{
class toPDF
{
static void Main(string[] args)
{
//Load Document
Document document = new Document();
document.LoadFromFile(@"E:\work\documents\TestSample.docx");
//Convert Word to PDF
document.SaveToFile("toPDF.PDF", FileFormat.PDF);
//Launch Document
System.Diagnostics.Process.Start("toPDF.PDF");
}
}
}
bhushan jat9 reputationPosted Apr 24, 2015, 1:57 AM EDT
Jonathan Sterling19 reputationPosted Jun 26, 2015, 12:32 AM EDT
var application = new Application(); var document = application.Documents.Open(FileName: @"C:\Sample.docx"); document.ExportAsFixedFormat(OutputFileName: @"C:\Sample.pdf", ExportFormat: WdExportFormat.wdExportFormatPDF);