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

Convert from docx to PDF

Hello, we are evaluating the latest version of Syncfusion DocioRenderer.Net.Core (20.4.0.52)  for docx to pdf export, but the PDF obtained is not the same. Take a look to the 2 files attached, the first page in the PDF seems like corrupted.


Attachment: docx_pdf_5b9142b1.zip

2 Replies

SB Suriya Balamurugan Syncfusion Team March 8, 2023 05:48 PM UTC

Hi Jose,

We have reproduced three reported problems while converting Word document to PDF in our end,

  • Text inside frame is not preserved in the correct angle
  • Table is not preserved properly
  • Content is not preserved properly in table

We suspect these to be defects. We will validate this issue and update you with more details on 10th March 2023.

Regards,
Suriya Balamurugan.



LB Lokesh Baskar Syncfusion Team March 10, 2023 05:06 PM UTC

Hi Jose,


Please find the details of reported issues:
 

Issues 

Screenshots

Details 

Table is not preserved properly

We confirmed the issue “Header bottom position is not updated properly while converting Word to PDF” as a defect and we will include the fix into our upcoming weekly NuGet release, which will be available on 28th March 2023.

 

Please use the below feedback link to track the status of the reported bug.

https://www.syncfusion.com/feedback/41982/header-bottom-position-is-not-updated-properly-while-converting-word-to-pdf

Text inside frame is not preserved in the correct angle

Currently, Essential DocIO does not provide support for frame text direction while converting the Word document to PDF. We have considered this as a feature in our database. We don’t have any immediate plans to implement this feature. At the planning stage of every release cycle, we review all open features and we will let you know once this feature is implemented.

You can track the status of this feature from the below feedback link:
https://www.syncfusion.com/feedback/37425/support-for-frame-text-direction-while-converting-the-word-document-to-pdf

As a workaround, you may use the textbox and change text direction in it.

We have modified the given input Word document and please refer to the below attachment.

Content is not preserved properly in table

On further investigating the reported issue, we have found that the fields used in the given Word document is not updated properly. To update the document fields in the Word document using DocIO library we should call the UpdateDocumentFields API during the Word to PDF conversion. Please refer to the below code to update the document fields during the Word to PDF conversion.

using (FileStream fileStream = new FileStream(Path.GetFullPath(@"../../../Template.docx"), FileMode.Open))

            {

                //Loads an existing Word document.

                using (WordDocument wordDocument = new WordDocument(fileStream, Syncfusion.DocIO.FormatType.Automatic))

                {

                    //Updates the fields present in a document

                   wordDocument.UpdateDocumentFields(true);

                    //Creates an instance of DocIORenderer.

                    using (DocIORenderer renderer = new DocIORenderer())

                    {

                        //Converts Word document into PDF document.

                        using (PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument))

                        {

                            //Saves the PDF file to file system.   

                            using (FileStream outputStream = new FileStream(Path.GetFullPath(@"../../../WordToPDF.pdf"), FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite))

                            {

                                pdfDocument.Save(outputStream);

                            }

                        }

                    }

                }

            }

Please refer the UG link to know more about Update Fields in the document.
https://help.syncfusion.com/file-formats/docio/working-with-fields#updating-fields


Regards,

Lokesh B


Attachment: 105.603.1Qss_Modified_e82b70d4.docx

Loader.
Up arrow icon