【问题标题】:Cross in Zapf Dingbats not rendering in iText 7 PDFZapf Dingbats 中的交叉未在 iText 7 PDF 中呈现
【发布时间】:2017-12-08 19:45:54
【问题描述】:

我在用 VB 编写的 ASP.NET Web 应用程序中使用 iText 7 构建 PDF 文件。

使用以下代码在表格单元格中呈现勾号/复选标记可以正常工作:

Dim symbolFont = PdfFontFactory.CreateFont(FontConstants.ZAPFDINGBATS, PdfEncodings.ZAPFDINGBATS)

New Cell().Add(New Paragraph().Add(New Text(Convert.ToChar(&H2713)))).SetFont(symbolFont)

但是,当我用 &H2715 替换 unicode 时,什么都不会呈现。 2715 应该是一个十字架,根据这个 PDF:http://www.unicode.org/charts/PDF/U2700.pdf

1) 为什么我将代码更改为 2715 时没有显示十字?

2) 如何使用 iText 7 渲染刻度或十字?

【问题讨论】:

    标签: asp.net vb.net pdf unicode itext7


    【解决方案1】:

    将此代码用作复选标记:

    Dim symbolFont = PdfFontFactory.CreateFont(FontConstants.ZAPFDINGBATS, PdfEncodings.WINANSI)
    
    New Cell().Add(New Paragraph().Add(New Text(Convert.ToChar(&H51)))).SetFont(symbolFont)
    

    还有这件十字架:

    New Cell().Add(New Paragraph().Add(New Text(Convert.ToChar(&H53)))).SetFont(symbolFont)
    

    【讨论】:

    • 谢谢,我去看看。你知道为什么我的代码呈现了一个勾号而不是一个叉号吗?
    • 摇摆不定。 51 似乎是星号,而 53 似乎是星号。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-09-10
    • 1970-01-01
    • 2013-11-25
    • 2015-05-21
    • 1970-01-01
    • 1970-01-01
    • 2021-07-05
    相关资源
    最近更新 更多