I try to print a .pdf file with the following code:
- Code: Select all
...
Dim pdf As PdfDocument = New PdfDocument()
Dim iPagesPrinted As Integer = 0
Dim strFileContent as string = File.ReadAllText(strPdfFile, System.Text.Encoding.Default)
Try
pdf.LoadFromBytes(System.Text.Encoding.Default.GetBytes(strFileContent))
pdf.PrintSettings.DocumentName = "somename"
pdf.PrintSettings.PrinterName = "\\myprinter\myqueue"
pdf.PrintSettings.Duplex = System.Drawing.Printing.Duplex.Simplex
pdf.PrintSettings.Color = False
pdf.PrintSettings.PrintController = New System.Drawing.Printing.StandardPrintController()
pdf.Print()
iPagesPrinted = pdf.Pages.Count
pdf.Close()
Catch ex As Exception
SendErrorMail(ex, Nothing)
End Try
...
So far so good, we have now the problem that most of the time pages at the end are missing in the output.
For example when the file contains 92 pages, only 89 pages are printet.
Same code, same file, somtimes 1 page at the end is missing, sometime 2 sometime correct number of pages is printed.
Problem showed up with spire.pdf 5.6.2. Upgrade to 5.11.2 did not help.
Any help is highly appreciated.
TIA
Dan