conversion of large word doc to pdf is very slow, also often results in out of memory errors when resulting pdf is greater then 3mb

I am mail merging a word document, i then save that document as a temporary file, kill the word document from memory, then use

new DocToPDFConverter().ConvertToPDF("tempdoc.docx").Save("temppdf.pdf");

to convert, then use 

PdfViewerControl1.Load("temppdf.pdf");

to load the document into the instance i have in my wpf form.

if the document has a lot of pages (300+) the merging/conversion and dispay goes incedibly slow, and frequently end up swith an out of memory error.

is there any way to speed up the processes of conversion and merge? or any ways to use an alternative memory strategy for larger documents?



1 Reply

DB Dilli Babu Nandha Gopal Syncfusion Team July 5, 2018 11:46 AM UTC

Hi Scott, 
 
We suggest you to set EnableFastRendering flag as true in DocIO to perform Word to PDF conversion faster by using direct PDF rendering approach.
Please refer the below code example and let us know if this helps you: 
 
//Loads an existing Word document  
WordDocument wordDocument = new WordDocument("tempdoc.docx");  
//Creates an instance of the DocToPDFConverter - responsible for Word to PDF conversion  
DocToPDFConverter converter = new DocToPDFConverter();  
//Sets true to enable the fast rendering using direct PDF conversion.  
converter.Settings.EnableFastRendering = true;  
//Converts Word document into PDF document  
PdfDocument pdfDocument = converter.ConvertToPDF(wordDocument);  
//Releases all resources used by the DocToPDFConverter object  
converter.Dispose();  
//Saves the PDF file to file system  
pdfDocument.Save("temppdf.pdf");  
//Closes the instance of document objects  
pdfDocument.Close(true);  
wordDocument.Close();  
 
  
We suggest you to use x64 processor to utilize the available RAM and convert without out of memory exception.  
 
If you are still facing the same problem means, we suspect that the problem might be due to the contents in the input word document and the code snippets used in your application. Could you please provide us the following details from your end:
  1. Input Word document with complete sample. If you have any confidential data in your Word document, please replace with some dummy data and provide us the same. We just need your document to recreate the problem you face.
  2. Platform target used in your application. (Right click on your project -> Properties ->Build).
  3. RAM used at your end.

 
Based on the above details, we will analyze further on the reported problem and will provide you the appropriate solution at the earliest.

 
Regards, 
Dilli babu. 


Loader.
Up arrow icon