我使用Itext7从html字符串生成pdf,使用C#,颜色类下没有颜色。
.SetFontColor(Color.RED)// there is not RED property我已经有了using iText.Kernel.Colors;,我需要为此安装哪个软件包?
对于Chunk linebreak = new Chunk,我需要安装的软件包也是一样
如何在段落中添加链接,使用new Paragraph(添加pdf文档??
谢谢
发布于 2018-09-17 08:26:25
iText 7是以前的iText版本的一个完整的重写,因此许多事情是不同的。
例如:
Color类中,而是存储在ColorConstants类中。现在您需要的不是Color.RED,而是ColorConstants.RED:http://itextsupport.com/apidocs/iText7/latest/com/itextpdf/kernel/colors/ColorConstants.html#REDChunk类不再存在。最接近Chunk的类是Text:http://itextsupport.com/apidocs/iText7/latest/com/itextpdf/layout/element/Text.htmlAnchor添加链接的Paragraph类现在称为Link:http://itextsupport.com/apidocs/iText7/latest/com/itextpdf/layout/element/Link.htmlColorConstants类在内核包中;Text和Link在布局包中。这解决了你在问题中列出的三个具体问题。如果从旧的iText版本迁移到新的iText版本,您将遇到许多其他的不同。在在线教程中解释了其中许多不同之处。
https://stackoverflow.com/questions/52363202
复制相似问题