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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Equations not properly converted when converting from Word to PDF

Thread ID:

Created:

Updated:

Platform:

Replies:

144207 Apr 24,2019 06:07 PM UTC Apr 29,2019 08:48 AM UTC ASP.NET Core - EJ 2 3
loading
Tags: DocIO
Michael
Asked On April 24, 2019 06:07 PM UTC

Hello!

Is this a limitation of the library or is there a possible workaround?

Thanks!

Meikanda Nayanar [Syncfusion]
Replied On April 25, 2019 11:53 AM UTC

Hi Michael 
 
We need to analyze your input Word document to understand which type of equation is used. Syncfusion Word library (DocIO) does not support equations created other than “Equation field”. Could you please provide us the input Word document along with the code snippets which are used at your end? So that we can analyze further in line with your requirement and provide exact solution at the earliest.

Note: 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.
 
 
Please let us know if you need any further assistance in this. 

Thanks 
Meikandan 


Michael
Replied On April 25, 2019 08:44 PM UTC

Hi!

Thanks for the response. Here is the input *.docx file and output *.pdf file.

The code I used is:

using (MemoryStream mem = new MemoryStream())
            {
                mem.Write(Input, 0, Input.Length);

                //Loads an existing Word document
                WordDocument wordDocument = new WordDocument(mem, FormatType.Docx);

                //Initializes the ChartToImageConverter for converting charts during Word to pdf conversion
                wordDocument.ChartToImageConverter = new ChartToImageConverter();

                //Sets the scaling mode for charts (Normal mode reduces the Pdf file size)
                wordDocument.ChartToImageConverter.ScalingMode = ScalingMode.Normal;

                //Creates an instance of the DocToPDFConverter - responsible for Word to PDF conversion
                DocToPDFConverter converter = new DocToPDFConverter();

                //Sets ExportBookmarks for preserving Word document headings as PDF bookmarks
                converter.Settings.ExportBookmarks = Syncfusion.DocIO.ExportBookmarkType.None;

                //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);

                using (MemoryStream mem2 = new MemoryStream())
                {
                    //Saves the PDF file to file system
                    pdfDocument.Save(mem2);

                    //Closes the instance of document objects
                    pdfDocument.Close(true);

                    wordDocument.Close();

                    Output = mem2.ToArray();
                }
}

It is almost the same as what is found in the documentation for DocIO.

Thanks!

Attachment: Equations_a8356b7f.rar

Vijayasurya Anandhan [Syncfusion]
Replied On April 29, 2019 08:48 AM UTC

Hi Michael, 
 
Thanks for your update. 
 
On further analyzing the input word document provided from your side, we found that the input word document contains “EquationML” elements. Currently DocIO doesn’t have support for EquationML in a Word document. So, equations are not preserved properly in Word to PDF conversion. We have already logged this requirement as a feature request, but we don’t have any immediate plans to implement this feature. At the planning stage for every release cycle, we review all open features. We will let you know when this feature is implemented. The status of implementation can be tracked through our Features Management System: 
  
As a workaround, the equation can be saved as an image and replaced in the Word document using Microsoft Word and then use the Word document for conversion. Please find the input Word document and generated PDF for the above workaround in the following sample.  
Thanks, 
Vijayasurya A 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon