IText 7链接边框显示 [英] IText 7 Link Border Showing
问题描述
使用Itext 7生成pdf并发现不推荐使用Anchor标签,因此使用链接.
Using Itext 7 for generating pdf and found Anchor tag is deprecated hence used Link.
Link projectNameLink = new Link("**Test**", PdfAction.createURI("https://www.google.com"));
projectNameLink.setFontColor(Color.BLUE)
.setBorder(Border.NO_BORDER);
Paragraph footerContent = new Paragraph().add(projectNameLink).setBorder(Border.NO_BORDER);
将此添加到段落中. Acrobat Reader中的文档在 Test 周围显示边框.我在下面的Url中也看到了同样的事情.是虫子吗?或缺少某些东西.如何删除边框?
Added this to paragraph. The document in Acrobat Reader shows border around Test. Same thing I see in the below Url . Is it a bug ? Or am missing something. How to remove the border ?
并在Acrobat Reader中打开,可以看到链接文本"上的边框.
And open in Acrobat Reader on can see borders along the Link Text.
推荐答案
iText的默认行为是添加边框. 但是,您可以对这些操作应用某种样式.
The default behaviour for iText is to add the border. You can however apply some style to these actions.
PdfAnnotation la1 = new PdfLinkAnnotation(new Rectangle(0, 0, 0, 0))
.setHighlightMode(PdfAnnotation.HIGHLIGHT_INVERT)
.setAction(js)
.setBorderStyle(PdfAnnotation.STYLE_UNDERLINE); // this is what you need
看看 http://developers .itextpdf.com/content/itext-7-building-blocks/examples/chapter-6
这篇关于IText 7链接边框显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!