PDFSharp不会在特定机器上绘制线条



我有一个奇怪的问题。使用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:TempDirtest.pdf")
document.Dispose()
document = Nothing

这似乎是一个PDFSharp v.1.50.5147错误。作为一种变通方法,你可以尝试1.32.3057或更旧的版本,它对我有效。

最新更新