Large MS Word document convertion fails and leaks memory

I have sample large MS Word document (attached) that fails ToPDF conversion with following error:

  at Syncfusion.Drawing.SkiaSharpHelper.Graphics..ctor (Syncfusion.Drawing.SkiaSharpHelper.Image image) [0x0004d] in <9830945476f34c658431c5c678b14bc7>:0
  at Syncfusion.DocIORenderer.DocIORenderer.DrawDirectWordToPDF (Syncfusion.DocIO.DLS.Rendering.DocumentLayouter layouter) [0x000c7] in <74740658f7ce4bdab24bbaf90f722b8b>:0
  at Syncfusion.DocIORenderer.DocIORenderer.ConvertToPDF (Syncfusion.DocIO.DLS.WordDocument wordDocument) [0x000c7] in <74740658f7ce4bdab24bbaf90f722b8b>:0
  at Syncfusion.DocIORenderer.DocIORenderer.ConvertToPDF (System.IO.Stream stream) [0x00009] in <74740658f7ce4bdab24bbaf90f722b8b>:0
  at company.OfficeConverter.OfficeConverter.WordToPdf (System.String filePath) [0x0008b] in company.OfficeConverter/OfficeConverter.cs:54


After that any subsequent call to render.ConvertToPDF(docStream) fails with OutOfMemoryException. I'm afraid that multiple conversions of smaller documents can do the same if the DocIO is leaking memory.

Sample code and document are attached to this post.


Attachment: Archive_2761f22b.zip

6 Replies

BP Bartlomiej Pater January 25, 2022 03:00 PM UTC

Could also be nice to have parameter to limit amount of pages to convert.



LB Lokesh Baskar Syncfusion Team January 26, 2022 09:25 PM UTC

Hi Bartlomiej, 
https://www.syncfusion.com/downloads/support/directtrac/general/ze/WordToPDFSample488206273.zip

Could you please try the same sample application at your end and provide us confirmation whether you are facing issue in this simple sample too.
 
If the issue not reproduced using the above sample application at your end, then could you please modify the above sample as issue reproduceable sample application, Syncfusion product version which you are using in your application. Thereby, we will proceed further to replicate the same problem at our end and will provide the more details.

 
Regarding Could also be nice to have parameter to limit amount of pages to convert. 
The Word document is a flow document in which contents will not be preserved page by page; instead the contents will be preserved sequentially section by section. 
Word viewer/editor renders the contents of the Word document page by page dynamically when opened for viewing or editing. This page wise rendered information will not be preserved in the saved file level.  
Essential DocIO is a non-UI component that provides a full-fledged document object model (logical structure as defined in the file level) to manipulate the Word document contents without converting page by page. So, it is not feasible to identify the pages of Word document (limit amount of pages) and then convert to PDF using Word library (DocIO).

Regards, 
Lokesh B 



BP Bartlomiej Pater January 27, 2022 08:40 PM UTC

Hello Lokesh,

The sample you've provided works fine.

When I isolate my code it also seems to be working. I have created new page with only single UI button and then it works but when there are more UI elements the code crashes. I will try to replicate the problem in your sample and send it.


Regarding the limiting parameter:

I think it could be done as a DocIO Renderers' ConvertToPDF parameter - renderer could stop after it finishes X page. When rendering process is happening it is known how many pages have already been completed.




BP Bartlomiej Pater January 27, 2022 08:40 PM UTC

I am using latest version available today - 19.4.0.47




MR Manikandan Ravichandran Syncfusion Team January 28, 2022 03:26 PM UTC

Hi Bartlomiej,

Thank you for your update.

Reg - I will try to replicate the problem in your sample and send it.
Please share the simple sample, once you replicate the issue at your end and we will wait for this sample.

Regarding the limiting parameter:

We will analyse the feasibility to achieve this requirement and we will share the details on 01st February 2022.

Regards,
Manikandan Ravichandran 



MR Manikandan Ravichandran Syncfusion Team February 1, 2022 04:28 PM UTC

Hi Bartlomiej,

We have considered your request as a feature in our end, and we don’t have an immediate plan to implement this feature. We will update you with more details once this feature implemented.

The status of this feature task can be tracked through the following link:
https://www.syncfusion.com/feedback/32344/support-to-convert-a-specific-pages-of-word-document-to-pdf

Regards,
Manikandan Ravichandran
 


Loader.
Up arrow icon