Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Nov 11, 2019 12:51 pm

Hi all,
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

BEKB
 
Posts: 11
Joined: Wed Dec 16, 2015 2:36 pm

Tue Nov 12, 2019 2:24 am

Hi Dan,

Thanks for your inquiry.
I had printed a file with 92 pages and your code many times, but didn't encounter the issue you mentioned. Please provide following information for further investigation:
1. A sample PDF which could reproduce the issue
2. The OS and Region information, e.g. Win7 64bit, China/Chinese
3. Does only one printer has that issue or all printer on your side has that issue? Also please tell the printer name/type

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Nov 13, 2019 3:46 pm

Hi Betsy,
Thanks for your replay.

The problem is a bit mistiruous couse it's not reproduceable.
Once printed there is 1 page missing at the end, printed again 2 pages are missing, printed a third time the entire file is printed correctly ?!
When I print then the file via Acrobat reader all is printed correctly !?
Unfortunately I cannot send you a sample .pdf cause the file contains sensitive data.
OS is Win 2012 Srv, Region is German(Switzerland)
Problem shows up on two different Network printers (HP LJ 600 M602)

Thanks for your support.
Dan

BEKB
 
Posts: 11
Joined: Wed Dec 16, 2015 2:36 pm

Thu Nov 14, 2019 2:47 am

Hi Dan,

Thanks for your information.
The issue is strange. Do you use multi-threading to print file?
I am afraid it is difficult for us to locate the root of your issue if we don't reproduce your issue on our side. Please kindly note that we take customer's confidential information as serious as them. We will never publish or disclose any information of our customer. This is always the promise we keep to our customer and the regulation we must obey. We promise to keep it confidential and won't use it for any other purpose. Or you could remove the sensitive data from your file as long as the file could reproduce your issue.
You could send a sample project which includes the sample file to us(support@e-iceblue.com) via email.

Many thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Dec 10, 2019 7:07 am

Hi Dan,

Hope you are doing well.
Has your issue been resolved? If not, please provide the information I mentioned in last post for further investigation.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF