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 Jan 26, 2018 10:12 am

Hello,
We are converting HTML to PDF and and saving the PDF files to a folder. Once the files are saved we are sending PDF files to print using below code.
Code: Select all
string[] fileArray = Directory.GetFiles(pdffilepath);
                foreach (string fileName in fileArray)
                {                   
                    printerName = @"\\IPAddress\PrinterName";
                    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 = 1;
                    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.SelectSinglePageLayout(PdfSinglePageScalingMode.CustomScale, false, 100f);
                    doc.PrintSettings.SetPaperMargins(0, 0, 0, 0);
                    doc.Print();
                }

we are generating PDF with max of 50 pages in it. While HTML is converted to PDF(50 pages pdf) and saved in the folder its size is between 500kb to 600kb. But after sending the PDF to Printer using the above code the same PDF is showing 7mb to 8mb size and due to this print is getting delayed. We have observed this pdf size change in "See Whats Printing" section of printer.
Could you please let us know what might me the reason for change in the size and how to send the pdf(with original size) to Printer.

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

Mon Jan 29, 2018 7:07 am

Hello,

Thanks for your inquiry. Generally speaking, the documents will be converted to bitmaps with high quality which could be recognized by the printer while printing. The size you were seeing in "See Whats Printing" is the bitmaps and usually it's much more bigger than the original file. Of course, the conversion takes more time with large file.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Mon Jan 29, 2018 8:50 am

Hello,
Don't we have a solution for this? Because the same PDF(Original size 500kb) that is sent to printer via code is getting converted to 7mb to 8mb but when it is sent to printer from windows by clicking Control+P is getting converted to 3mb.

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

Mon Jan 29, 2018 9:06 am

Hello,

Thanks for your reply. Would you please share us with your PDF? Then we will look into it and see if there is any solution.

Best regards,
Simon
E-icelbue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Mon Jan 29, 2018 4:10 pm

Hello,
I have emailed you the PDF please let us know after further investigation.

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

Tue Jan 30, 2018 7:54 am

Hello,

Thanks for your sharing. I printed your document via Adobe and Spire.Pdf, the sizes I saw were the same. Please check the attached screenshot. On the hand had, I found there was a delay for several seconds when printing var Spire.Pdf which was reasonable.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Tue Jan 30, 2018 9:17 am

Hello,
Thanks for quick response.... I would like to know what is the reason for delay while printing from Spire.PDF?

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

Wed Jan 31, 2018 3:55 am

Hello,

Thanks for your reply. While printing, the program takes time to analysis the data and draw the image for printing. I have to say Adobe have a better optimization on that. Although, I have post this case to our DEV team to see if there is any solution to optimize it.

Best regards,
Simon
E-iceblue
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Wed Jan 31, 2018 5:00 am

Hello,
Thanks for the info... Please keep us posted once you have update from your DEV team.

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

Wed Jan 31, 2018 6:15 am

Hello,

Sure, we will keep you informed.

Best regards,
Simon
E-iceblue support team
User avatar

Simon.yang
 
Posts: 620
Joined: Wed Jan 11, 2017 2:03 am

Tue Jul 05, 2022 9:58 am

Hi,

Thanks for your patient waiting.
Glad to inform you that we just released Spire.PDF Pack(Hot Fix) Version:8.7.2 which optimized print time, you can download it from the following links to test.
Website link: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget link: https://www.nuget.org/packages/Spire.PDF/8.7.2

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.PDF