【问题标题】:Font adding using PDFsharp使用 PDFsharp 添加字体
【发布时间】:2013-04-28 16:37:30
【问题描述】:

我正在使用 PDFsharp 向 pdf 添加文本。但是当我使用下面的代码用这些字体添加以下文本时,我遇到了问题。在使用 PDFsharp 创建 PDF 并在 adobe reader 中打开它时,我收到类似“无法找到或创建字体'Windings'。某些字符可能无法正确显示或打印”的消息。它打开了

我尝试修改的源 PDF 包含字体 Helvetica 和 Windings(Embedded)

这是向 PDF 添加文本的代码的一部分

Dim font As XFont = New XFont("Verdana", 20, XFontStyle.Regular)
gfx.DrawString("Hello, World!", font, XBrushes.Black, New XRect(0, 0, page.Width, page.Height), XStringFormats.Center)
font = New XFont("WingDings", 20, XFontStyle.Regular)
gfx.DrawString("llll", font, XBrushes.Black, New XRect(25, 15, page.Width, page.Height), XStringFormats.Center)
font = New XFont("Helvetica", 20, XFontStyle.Regular)
gfx.DrawString("abcd", font, XBrushes.Black, New XRect(50, 25, page.Width, page.Height), XStringFormats.Center)

使用此代码文本成功添加后,但当我在 PDF 阅读器中打开时出现错误(请参阅上面的错误消息)。当我在 PDF 的属性中看到字体时,我发现以下内容

Helvetica、Verdana、绕组

但源 pdf 中的 Windings(Embedded) 不存在。同样在创建的pdf中,添加的绕组字体在其下显示实际字体为未知(实际字体:未知)。我认为这是错误。如何解决?我还想知道如何在 PDFsharp 中添加绕组规则(嵌入子集)? This is 我使用的源 PDF。 This is the 在 PDFsharp 中修改后创建的 PDF 会出错。

【问题讨论】:

    标签: vb.net pdf fonts pdfsharp


    【解决方案1】:

    使用 PDFsharp,您必须指定应嵌入字体(使用例如 PdfFontEmbedding.Alwayssee here)。

    默认情况下不会嵌入字体 - PDF 文件会更小,但在未安装此字体的计算机上显示时可能会出现问题。

    AFAIK PDFsharp 不能使用已嵌入 PDF 中的字体。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-10
      • 2014-10-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-13
      相关资源
      最近更新 更多