PDF 中的超链接文本未正确对齐。例如,如果 textfragment 既有普通文本又有超链接文本,与片段无关。IsInLineParagraph = true/false;
详细说明: 有多行带有普通文本的超链接文本,超链接内容以新行出现,而不是作为内联文本出现(与普通文本连续)。请找到随附的屏幕截图。
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);
请让我知道我是否遗漏了代码中的任何内容或为我提供解决方案。
提前致谢!