使用带有DOM方法的Aspose.Net PDF进行超链接对齐问题

时间:2015-06-09 11:09:26

标签: aspose aspose.pdf

超链接文字在PDF中未正确对齐。例如,如果textfragment具有普通文本和超链接文本,则无论fragment.IsInLineParagraph = true / false;

详细信息:多行超链接文本包含普通文本,超链接内容以新行显示,而不是内嵌文本(与普通文本连续)。请找到附带的屏幕截图。 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);

如果我错过任何代码或者为我提供解决方法,请告诉我。

提前致谢!

0 个答案:

没有答案