Skip to content

Instantly share code, notes, and snippets.

@awright18
Created February 25, 2021 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save awright18/fc92ac7bd1e94bdc5b45b4524ad73628 to your computer and use it in GitHub Desktop.
Save awright18/fc92ac7bd1e94bdc5b45b4524ad73628 to your computer and use it in GitHub Desktop.
Word To Pdf Conversion - Using Microsoft.Office.Interop.Word
using Microsoft.Office.Interop.Word;
namespace Word2Pdf
{
class Program
{
static void Main(string[] args)
{
Application appWord = new Application();
var wordDocument = appWord.Documents.Open(@"c:\users\awright2\desktop\imaword.docx",ReadOnly:true);
wordDocument.ExportAsFixedFormat(@"c:\users\awright2\desktop\imapdf.pdf", WdExportFormat.wdExportFormatPDF, OpenAfterExport:false);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment