特定机器上的 PDFSharp 不绘制线条

Lines are not drawn with PDFSharp on specific machines

我有一个奇怪的问题。 A 使用 PDFSharp 1.50.5147 从 .net 桌面应用程序生成 pdf 文件,在某些特定机器上,这些行未显示。显示了所有其他数据和文本,但没有显示任何内容。我有 pdf 格式的多种类型的线条、不同的粗细、规则和虚线。这些机器上不显示任何行,只显示文本。该应用程序在所有其他机器上都能很好地生成 pdf。

我应该寻找什么?我重新安装了 .Net Framework 4.7.2。替换 de PdfSharp dll..

如有任何想法,我们将不胜感激!

代码:

Dim fo As XPdfFontOptions = New XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always)
    Dim PrintFont14B As XFont = New XFont("Arial Narrow", 14, System.Drawing.FontStyle.Bold, fo)
    Dim BrushBlack As XBrush = XBrushes.Black
    Dim BrushGrey As XBrush = XBrushes.Gray
    Dim BrushRed As XBrush = XBrushes.Red
    Dim BrushWhite As XBrush = XBrushes.White
    Dim pen As New PdfSharp.Drawing.XPen(XColor.FromName("black"))
    Dim penTabel As New PdfSharp.Drawing.XPen(XColor.FromName("black"))
    Dim penDespartitor As New PdfSharp.Drawing.XPen(XColor.FromName("gray"))
    Dim x As Integer = 74
    Dim y As Integer = 268
    Dim p As PdfSharp.Drawing.XPoint
    Dim xSfarsitTabel As Integer = 575
    Dim gfx As PdfSharp.Drawing.XGraphics
    Dim document As PdfDocument
    Dim page As PdfPage
    document = New PdfDocument()

    page = document.AddPage()
    page.Orientation = PdfSharp.PageOrientation.Portrait
    gfx = PdfSharp.Drawing.XGraphics.FromPdfPage(page)

    p = New PdfSharp.Drawing.XPoint(x, y)
    gfx.DrawString("TEXT THAT PRINTS", PrintFont14B, BrushBlack, p)
    p.Y += 5
    gfx.DrawLine(pen, 225, p.Y, xSfarsitTabel, p.Y)

    document.Save("C:\TempDir\test.pdf")
    document.Dispose()

    document = Nothing

这似乎是 PDFSharp v.1.50.5147 的错误。作为解决方法,您可以尝试使用 1.32.3057 或更早版本,它对我有用。