IText 7链接边框显示 [英] IText 7 Link Border Showing

查看:122
本文介绍了IText 7链接边框显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆