We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Word doc converted to pdf, and then underline textfragments, underline placement is incorrect

Dear Support,

I was not sure whether to put this under the Words or Pdf forum. But since the main problem is with the pdf file, I put it here. I have created a very simple example of my problem. I create a simple Word document. Using Aspose.Words I convert the file to pdf. Then, I open the pdf file in Aspose.pdf and underline some of the text. The placement of the underlines is above the text that should be underlined. I have attached a zip file that contains a sample console application (Program.cs), a simple word file (testdoc5.docx), the output of the word conversion (testdoc5_noul.pdf) and the output of the underlining of text (testdoc5_ul.pdf).testdoc5.zip (42.6 KB)

@ILSTech

Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFNET-45341 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

However, until the logged ticket is investigated, you may use below code snippet as a workaround to avoid the incorrect underline placement:

        Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document( dataDir + "testdoc5_noul.pdf");

        Aspose.Pdf.Text.TextFragmentAbsorber abs = new Aspose.Pdf.Text.TextFragmentAbsorber("underline");
        abs.TextSearchOptions = new Aspose.Pdf.Text.TextSearchOptions(false);
        pdfDoc.Pages.Accept(abs);

        foreach (Aspose.Pdf.Text.TextFragment tf in abs.TextFragments)
        {
            foreach (TextSegment textSegment in tf.Segments)
            { 
                textSegment.TextState.Underline = true;
            }
        }
        pdfDoc.Save( dataDir + "testdoc5_ul_18.8.pdf");

We are sorry for the inconvenience.

1 Like

Are there any updates on this issue? I am able to use other 3rd party tools to convert word documents to pdf and then the underlining using Aspose.pdf is correct. However, I would really like to be able to use the Aspose libraries that I purchased and are already integrated in my application.

Thanks In Advance

Charles

@ILSTech

Thank you for getting back to us.

We are afraid PDFNET-45341 is pending for analysis. If you have requested to escalate priority of this ticket to paid support then please follow up in respective thread where we will keep you updated.

The issues you have found earlier (filed as PDFNET-45341) have been fixed in Aspose.PDF for .NET 19.1.