Click here to Skip to main content
15,889,849 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Hello,

im able to Convert a Doc file to PDF.
But the Way i am doing it is very slow, which makes it nearly unusable.
Im doing it the following way:

C#
wordDocument = appWord.Documents.Open(path, ReadOnly: false, Visible: false);
wordDocument.ExportAsFixedFormat(System.IO.Path.ChangeExtension(path, ".PDF"), WdExportFormat.wdExportFormatPDF, false, WdExportOptimizeFor.wdExportOptimizeForOnScreen,
                                                                WdExportRange.wdExportAllDocument, 1, 1, WdExportItem.wdExportDocumentContent, true, true,
                                                                WdExportCreateBookmarks.wdExportCreateHeadingBookmarks, true, true, false, ref oMissing);
wordDocument.Close(SaveChanges: false);
Posted
Comments
Whisortates 27-Oct-15 4:37am    
Generally speaking Microsoft's word automation in C# can yield a rather bad performances. This is because you're basically running the whole application (MS Word) and calling its functionalities.
Nevertheless you should check out that link, it is a comparison of word automation vs this C# library for word files. Also here is an article that demonstrates how to convert the Word document into a PDF in C# with it.

1 solution

There is no way to speed that up. The operation is completely out of your control.

You can TRY other PDF libraries, such as CutePDF and "printing" the word document to a PDF file, but you'll likely end up with the same problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900