Hyperlink Alignment issue with Aspose.Net PDF with DOM Approach

331 views Asked by At

Hyperlink text not aligned properly in PDF. For example,if textfragment have Both normal text and hyperlink text irrespective of fragment.IsInLineParagraph = true/false;

in detail: have a multiple lines of hyperlink text with normal text, Hyperlink content coming in new line and not coming as inline text (continuous with normal text). Please find the attached screenshot. enter image description here

        TextFragment fragment = new Aspose.Pdf.Text.TextFragment();
        TextSegment segment1 = new TextSegment("Before hyperlink ");
        segment1.TextState.FontSize = 12;
        segment1.TextState.Font= Aspose.Pdf.Text.FontRepository.FindFont("Arial");
        fragment.Segments.Add(segment1);
        fragment.IsInLineParagraph = true;
        floatBox.Paragraphs.Add(fragment);

        fragment = new Aspose.Pdf.Text.TextFragment();
        fragment.IsInLineParagraph = true;
        TextSegment segment = new TextSegment("This is Hyperlink This is HyperlinkThis is HyperlinkThis is HyperlinkThis is HyperlinkThis is HyperlinkThis is HyperlinkThis is HyperlinkThis is HyperlinkThis is Hyperlink ");
        segment.TextState.ForegroundColor = Aspose.Pdf.Color.FromArgb(0, 119, 204);
        segment.TextState.Underline = true;
        segment.TextState.FontSize = 12;
        segment.TextState.Font = Aspose.Pdf.Text.FontRepository.FindFont("Arial");
        fragment.Segments.Add(segment);
        fragment.Hyperlink = new WebHyperlink("www.aspose.com");
        fragment.IsInLineParagraph = true;
        floatBox.Paragraphs.Add(fragment);

        fragment = new Aspose.Pdf.Text.TextFragment(" after hyperlink");
        fragment.IsInLineParagraph = true;
        floatBox.Paragraphs.Add(fragment);

Please Let me know if i miss anything in code or provide me solution how to resolve it.

Thanks in Advance!

0

There are 0 answers