PrintDialog ToPage 应小于页数
PrintDialog ToPage should be less than the page count
我最近将我的计算机升级到 Windows 10,现在其中一个程序在升级后运行异常。
尝试打印 PDF 之外的页面范围,当我打印第 1 到 100 页(共 477 页)时,我收到一条错误消息 ToPage should be less than the page count
,即使 100 小于 477。
如果我跳过页面范围部分并让它打印所有页面,它就可以正常工作。
Sub PrintToPaperSync(ByVal InputfilePath As String, Optional ByVal DeleteAfter As Boolean = False)
On Error GoTo sError
Dim tError As String = ""
Dim toPage As Integer = 0
Console.WriteLine("PrintToPaper " & InputfilePath)
Dim File As String = Split(InputfilePath, "\")(Split(InputfilePath, "\").Length - 1)
Dim viewer As New Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView
viewer.Load(InputfilePath)
Dim print As New System.Windows.Forms.PrintDialog()
print.Document = viewer.PrintDocument
print.Document.DocumentName = File
'print 100 pages at a time
Do While toPage < viewer.PageCount
print.Document.PrinterSettings.PrintRange = Drawing.Printing.PrintRange.SomePages
print.Document.PrinterSettings.FromPage = toPage + 1
toPage += 100
print.Document.PrinterSettings.ToPage = IIf(toPage < viewer.PageCount, toPage, viewer.PageCount)
tError = "From: " & print.Document.PrinterSettings.FromPage & " | To: " & print.Document.PrinterSettings.ToPage & " | PageCount: " & viewer.PageCount & " - "
print.Document.Print()
Application.DoEvents()
Loop
viewer.Unload()
viewer.Dispose()
Console.WriteLine("Printing: " & InputfilePath)
Exit Sub
sError:
Dim ErrorStr As String = ErrorToString()
WriteLine("PrintToPaper " & tError & " " & InputfilePath & " - " & ErrorStr)
End Sub
错误全文:
PrintToPaper From: 1 | To: 100 | PageCount: 477 - F:\Process\LogTag-10-30-15-104122.pdf - ToPage should be less than the page count
我们只想一次打印 100 页,因为打印机出于某种原因在 100 页后开始变慢。
此打印问题是由于 Syncfusion Control 的问题引起的。您可以联系 Syncfusion 软件支持团队来解决问题。请按照以下link联系Syncfusion支持团队
我最近将我的计算机升级到 Windows 10,现在其中一个程序在升级后运行异常。
尝试打印 PDF 之外的页面范围,当我打印第 1 到 100 页(共 477 页)时,我收到一条错误消息 ToPage should be less than the page count
,即使 100 小于 477。
如果我跳过页面范围部分并让它打印所有页面,它就可以正常工作。
Sub PrintToPaperSync(ByVal InputfilePath As String, Optional ByVal DeleteAfter As Boolean = False)
On Error GoTo sError
Dim tError As String = ""
Dim toPage As Integer = 0
Console.WriteLine("PrintToPaper " & InputfilePath)
Dim File As String = Split(InputfilePath, "\")(Split(InputfilePath, "\").Length - 1)
Dim viewer As New Syncfusion.Windows.Forms.PdfViewer.PdfDocumentView
viewer.Load(InputfilePath)
Dim print As New System.Windows.Forms.PrintDialog()
print.Document = viewer.PrintDocument
print.Document.DocumentName = File
'print 100 pages at a time
Do While toPage < viewer.PageCount
print.Document.PrinterSettings.PrintRange = Drawing.Printing.PrintRange.SomePages
print.Document.PrinterSettings.FromPage = toPage + 1
toPage += 100
print.Document.PrinterSettings.ToPage = IIf(toPage < viewer.PageCount, toPage, viewer.PageCount)
tError = "From: " & print.Document.PrinterSettings.FromPage & " | To: " & print.Document.PrinterSettings.ToPage & " | PageCount: " & viewer.PageCount & " - "
print.Document.Print()
Application.DoEvents()
Loop
viewer.Unload()
viewer.Dispose()
Console.WriteLine("Printing: " & InputfilePath)
Exit Sub
sError:
Dim ErrorStr As String = ErrorToString()
WriteLine("PrintToPaper " & tError & " " & InputfilePath & " - " & ErrorStr)
End Sub
错误全文:
PrintToPaper From: 1 | To: 100 | PageCount: 477 - F:\Process\LogTag-10-30-15-104122.pdf - ToPage should be less than the page count
我们只想一次打印 100 页,因为打印机出于某种原因在 100 页后开始变慢。
此打印问题是由于 Syncfusion Control 的问题引起的。您可以联系 Syncfusion 软件支持团队来解决问题。请按照以下link联系Syncfusion支持团队