We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Word2PDF conversion freezes on a mal-formatted .doc file

Hi there.

I'm using DocIO packages (version 14.3.0.52), trying to convert a bunch of files with a console application:

            using (var document = new WordDocument(sourcePath))

            {

                document.ChartToImageConverter = new ChartToImageConverter();

                document.ChartToImageConverter.ScalingMode = Syncfusion.OfficeChart.ScalingMode.Normal;

                

                using (var converter = new DocToPDFConverter())

                {

                    converter.Settings = new DocToPDFConverterSettings

                    {

                        PdfConformanceLevel = PdfConformanceLevel.Pdf_A1B

                    };

                    //Convert word document into PDF document

                    using (var pdfDoc = converter.ConvertToPDF(document))

                    {

                        pdfDoc.EnableMemoryOptimization = false;

                        pdfDoc.Save(dstPath);

                        pdfDoc.Close();

                    }

                }

                document.Close();

            }


There's a mal-formatted Word file, and when the application reaches the file and tries to convert it to PDF (var pdfDoc = converter.ConvertToPDF(document)), it freezes forever, even though MS Word itself opens the file and saves it to PDF just fine.

Attachment: doc_d75d0f75.zip

3 Replies

VR Vijay Ramachandran Syncfusion Team November 17, 2016 05:46 AM UTC

Hi Sergey,

Thank you for using Syncfusion products.

A support incident to track the status of your query has been created under your account. Please log on to our support website to check for further updates,

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let us know if you have any concern.

Regards,
Vijay R
 



AA Aaron November 25, 2019 03:09 PM UTC

was this ever solved? I am running into the same issues with version 17.3.0.28.  I load a word doc and attempt to convert to a pdf, and it hangs indefinitely without ever throwing an exception or moving forward.  

using (var renderer = new DocIORenderer()) {
                    using (var stream = new MemoryStream(fileData)) {
                        using (var wordDoc = new WordDocument(stream, fileType)) {
                            using (var pdfDoc = renderer.ConvertToPDF(wordDoc)) {
                                var returnStream = new MemoryStream();
                                pdfDoc.Save(returnStream);

                                _openStreams.Add(returnStream);
                                pdfDoc.Close();

                                return returnStream;
                            }
                        }
                    }
                }


VA Vijayasurya Anandhan Syncfusion Team November 26, 2019 10:42 AM UTC

Hi Sergey,


Thank you for your update.


We have tried to reproduce the issue with "Application hangs while convert the Word document to PDF" using the provided input Word document in our latest weekly NuGet release version "17.3.0.28", but it works fine as expected in our end.


Please find the sample used in our end to reproduce the issue from the below link:
https://www.syncfusion.com/downloads/support/forum/127450/ze/Sample-293152050.zip


Please find the generated PDF in our end from the below link:
https://www.syncfusion.com/downloads/support/forum/127450/pd/Output-1019542476.pdf


If you are continue to face the same issue means, then we would, therefore, like to set up a web meeting with you to reproduce the issue in your end. Could you please let me know of your availability for this? Our team will make every effort to have this scheduled on a date and time per your convenience.

Please let us know if you have any questions.

Regards,
Vijayasurya A




Loader.
Live Chat Icon For mobile
Up arrow icon