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

Free Support Forum - aspose.com

Double underline

I tried to create a document with only one paragraph, with only one word underlined.
Everything is fine, but if the paragraph is long and justified a double underline appears.
The second one is at the bottom of the page.
If I remove the justified the second underline does not appear.

        var myDoc = new Document();

        var myPage = myDoc.Pages.Add();

        var myFont = FontRepository.FindFont("Arial Narrow", FontStyles.Regular);
       var myParagraph = new TextParagraph { 
            HorizontalAlignment = HorizontalAlignment.Justify, //  If I remove the justified the second underline does not appear
       };
        myParagraph.FormattingOptions.WrapMode = TextFormattingOptions.WordWrapMode.ByWords;
        myParagraph.Position = new Position(20, 100);
        var builder = new TextBuilder(myPage);
        builder.AppendParagraph(myParagraph);

        var myTextFragment = new Aspose.Pdf.Text.TextFragment("normal text ");
            myTextFragment.TextState.FontSize = 10;
            myTextFragment.TextState.Font = myFont;
            myTextFragment.TextState.Underline = false; // underline;

        TextSegment myTextSegment;

        // Add Underline text
        myTextSegment = new TextSegment(" Underline text ");
        myTextSegment.TextState.Underline = true; // underline;
        myTextSegment.TextState.Font = myFont;
        myTextFragment.Segments.Add(myTextSegment);

        // Add a long text
        myTextSegment = new TextSegment(" Then a long text: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt"
            + " ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea"
            + "  commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
            + "  Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
            );
        myTextSegment.TextState.Font = myFont;
        myTextFragment.Segments.Add(myTextSegment);

        myParagraph.AppendLine(myTextFragment);
        myDoc.Pages.Add(); // adding a page for best view the secon underline.
        var pdfName = "C:\temp\sampleAspose.pdf"
        myDoc.Save(pdfName);

@i.montanelli

Can you please also share the output PDF generated at your end using this code snippet? We will compare it with the one generated at our end and proceed further.

Here it is.TestAspose.pdf (23.2 KB)

@i.montanelli

We have logged an issue as PDFNET-53413 in our issue tracking system. We will further look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.