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.

Fri May 19, 2017 11:16 am

Hello, we use to print pdf docs with more than 100 pages consecutively . Sometimes it takes (depending on Content) a very Long time to convert the print orders. Unfortueneatly the Print Progress Dialogs appear on the Screen and stop the user from working with the caller app. Is there a simple way to put print orders to Background when calling doc.PrintDocument.Print()?
Rgds
Thomas

tgrote
 
Posts: 8
Joined: Sat Nov 19, 2016 8:41 am

Mon May 22, 2017 6:04 am

Hello,

Thanks for your inquiry and sorry for the late reply as weekend.
Please use the code below to hide the process dialog:
Code: Select all
Dim printController As PrintController = New StandardPrintController()
printDocument.PrintController = printController


Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Tue May 23, 2017 4:37 am

Hello, this hides the Progress Dialog, but the printing process still locks the base app while printing. I think the printing processes has to be put in threads. Is there a sample for using the printing Controller in Background processes or do there are any settings to solve it?
Rgds
Thomas

tgrote
 
Posts: 8
Joined: Sat Nov 19, 2016 8:41 am

Tue May 23, 2017 10:35 am

Hello,

Sorry for my misunderstanding. In ragards to your requirement, please put the print process into a new thread. Just refer to the code below:
Code: Select all
 Thread thread = new Thread(new ThreadStart(print));
            thread.Start();


If there's still any problem, welcome to write back.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Fri May 26, 2017 8:12 am

I've tried threading before also with a backgroundworker. I'm getting memory exceptions while printing in background processes. I'm trying to analyse that and get back to you.
Rgds
Thomas

tgrote
 
Posts: 8
Joined: Sat Nov 19, 2016 8:41 am

Fri May 26, 2017 9:15 am

Hello,

Thanks for your inquiry.
To help us with a further investigation on this issue, could you send your document to us via email(support@e-iceblue.com)?
We will keep your document confidential and never use it for any other purposes.
Besides, also provide the following information.
1. Your OS information or the server infromation
2. The related code snippet

Many Thanks,
Jane
E-iceblue supprt team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Tue May 30, 2017 12:27 pm

Hello Jane,
The documents are simply scanned PDFs with more than 70 Pages. I want to print them in a for each loop. The base App is MS Outlook. The problem is that if i start printing Outlook is locked while printing. The reason for the long duration of printing maybe that scans being printed as image. Is there a way to optimize this? If i print the same Pdf with acrobat the printing progrees is very much faster.

i'm using the following code:

Private _strPdf As String
Private _intColor As Integer
Private _intDuplex As Boolean
Private _strPrinter As String

Sub New(strPdf As String, strPrinter As String, intDuplex As Integer, intColor As Integer)

_intColor = intColor
_intDuplex = intDuplex
_strPdf = strPdf
_strPrinter = strPrinter

Dim thread As Thread = New Thread(AddressOf StartPrint)
thread.SetApartmentState(ApartmentState.STA)
thread.Start()
'thread.Join()




End Sub
Private Sub StartPrint()

Dim Doc As PdfDocument = New PdfDocument()

Try


Doc.LoadFromFile(_strPdf)

If _strPrinter <> "" Then


If Doc.PrintDocument.PrinterSettings.CanDuplex Then
If _intDuplex = 0 Then Doc.PrintDocument.PrinterSettings.Duplex = Duplex.Simplex
If _intDuplex = 1 Then Doc.PrintDocument.PrinterSettings.Duplex = Duplex.Horizontal
If _intDuplex = 2 Then Doc.PrintDocument.PrinterSettings.Duplex = Duplex.Vertical
If _intDuplex <= 0 Or _intDuplex > 2 Then Doc.PrintDocument.PrinterSettings.Duplex = Duplex.Default
End If

If Doc.PrintDocument.PrinterSettings.SupportsColor Then
Doc.PrintDocument.PrinterSettings.DefaultPageSettings.Color = _intColor
End If

Doc.PageScaling = PdfPrintPageScaling.FitSize
Doc.PrinterName = _strPrinter
Doc.SaveToFile(_strPdf)
Doc.PrintDocument.Print()
Doc.Close()
Doc.Dispose()

End If



Catch ex As System.Exception
MsgBox(ex.ToString)
End Try
End Sub

Rgds
Thomas

End Class

tgrote
 
Posts: 8
Joined: Sat Nov 19, 2016 8:41 am

Wed May 31, 2017 4:18 am

Hello,

Thanks for your response.
With no luck, I didn't reproduce the issue using your code. Since every document has its unique structure, please send your sample pdf file to us for a further investigation. And also list the information of your system confuguration and the printer name.
Thanks for your understanding.

Sincerely,
Jane
E-iceblue suport team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Fri Jun 09, 2017 6:48 am

Hello Thomas,

Thanks for sharing your document via email.
Now the print issue with XpsPrintHelper has been resolved, once the hotfix is available, we will inform you.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.PDF