PDFsharp无法识别的字符显示为“?”

时间:2017-12-30 11:38:04

标签: vb.net unicode pdfsharp

我正在尝试将组合框的内容转换为PDFsharp中的文本进行打印。不幸的是,所有“✓”都变成了“?”。我尝试过使用Unicode但没有任何改变。

这是我正在使用的;

For Each cbx In Crt.Controls.OfType(Of ComboBox)
        If cbx.Visible = True Then
            Using Gra As XGraphics = XGraphics.FromPdfPage(Pg(Doc.PageCount - 1))
                Dim tf As Layout.XTextFormatter = New Layout.XTextFormatter(Gra)
                Dim x = cbx.Location.X * WScale
                Dim y = cbx.Location.Y * HScale
                Dim w = cbx.Width * WScale
                Dim h = cbx.Height * HScale
                Dim Brush As XBrush = New XSolidBrush(XColor.FromArgb(cbx.BackColor.ToArgb))
                Dim xrect As New XRect(x, y, w, h)
                Gra.DrawRectangle(Brush, xrect)
                Dim options As XPdfFontOptions = New XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always)
                Dim xFt As New XFont("Times New Roman", 7, XFontStyle.Regular, options)
                tf.Alignment = Drawing.Layout.XParagraphAlignment.Justify
                tf.DrawString(cbx.Text, xFt, XBrushes.Black, xrect, XStringFormats.TopLeft)
            End Using
        End If
    Next

1 个答案:

答案 0 :(得分:0)

角色"✓"可能不包含在" Times New Roman"您选择的字体,因此它不会显示。

仅使用" Times New Roman"中包含的字符。如果您需要"✓"。

,请使用适当的字体