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 Mar 20, 2020 10:05 am

Hello Team,
We have logic to convert HTML to PDF, Once the conversion is done we are sending this PDF files to network printers(which are shared over the network and added on the server) using a self hosted windows service. Below is the code we used from printing
Code: Select all
foreach (string fileName in fileArray)
                {
                   
                    FileInfo f = new FileInfo(fileName);
                    Spire.Pdf.PdfDocument doc = new Spire.Pdf.PdfDocument();
                    doc.LoadFromFile(f.FullName);
                    doc.PrintSettings.PrinterName = HttpUtility.UrlDecode(printerName);
                    doc.PrintSettings.Copies = copies;
                    doc.PrintSettings.DocumentName = Path.GetFileNameWithoutExtension(f.Name);
                    PaperSize paperSize = new PaperSize();
                    System.Drawing.SizeF size = doc.Pages[0].Size;
                    paperSize.Width = Convert.ToInt16(size.Width);
                    paperSize.Height = Convert.ToInt16(size.Height);               
                    paperSize.RawKind = (int)PaperKind.Custom;
                    doc.PrintSettings.PaperSize = paperSize;

                    doc.PrintSettings.SetPaperMargins(0, 0, 0, 0);
                    doc.Print();
}


Now the problem is if a single user is trying to print then printing is happening quickly in less than 5 seconds. But if there are multiple users who are concurrently working on this then print is getting delayed by 20 to 30 seconds( each user will print to different printers which are added over the server) . Is this anything related to threads that gets created when doc.print is invoked? Is there anything that we can do before doc.print is invoked to increase performance?

Server Info:
Server Version : Windows Server 2016 Standard
Type : 64 bit OS
RAM : 8GB

Print Info:
Input Doc: PDF
Time Delay : 20+ seconds when multiple users are using though the print is going to different printers

Is there any workaround to increase the print speed when multiple people invoke doc.print? Please let me know if you require any other additional info.

curvaturepdfapi
 
Posts: 32
Joined: Wed Apr 20, 2016 10:08 pm

Fri Mar 20, 2020 10:43 am

Hello,

Thank you for contacting.
Based on your scenario, the print speed will also be related to how many people do printing at the same time. Could you tell how many people do printing at the same time? And please share us with you testing PDF to help further investigate it. You can send your file to us here or via email (support@e-iceblue.com). Thanks in advance.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.PDF