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.

Tue Oct 10, 2017 1:38 pm

The license has been purchased and used for Spire.Pdf (3.9.360). (Email used to purchase: dhalvey@releasepoint.com)

We are doing conversion from multi-page tiff image to pdf document, but the amount of time taken is very long when number of pages is more than 10. I have used exact code from Spire.Pdf tutorial - https://www.e-iceblue.com/Tutorials/Spi ... ith-C.html

For example: I have attached Aastra.tif file, and this is taking more than 20 seconds to convert into pdf.

Please help us on improving performance of file conversion.

rajbhagat.sit@gmail.com
 
Posts: 5
Joined: Fri Oct 30, 2015 12:00 pm

Wed Oct 11, 2017 2:20 am

Hello,

Thanks for your inquiry.
The time performance is related to many factors, such as run-time system, document size and document complexity. And I have tested the file, and it took about 13s on my side. I have posted the time issue to our Dev team, we will investigate it and let you know once there is any progress.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Thu Oct 12, 2017 6:54 am

Hello,

After investigation, we found there is a way which is faster to draw the tiff on PDF. Please refer to the code below.
Code: Select all
            using (PdfDocument pdfDoc = new PdfDocument())
            {
                PdfImage img = PdfImage.FromFile(@"F:\testing\pdf form testing\original document\Aastra.tif");
                int count = (img as PdfBitmap).FrameCount;
                for (int i = 0; i < count; i++)
                {
                    (img as PdfBitmap).ActiveFrame = i;
                    PdfPageBase page = pdfDoc.Pages.Add();
                    float width = img.Width * 0.3f;
                    float height = img.Height * 0.3f;
                    float x = (page.Canvas.ClientSize.Width - width) / 2;
                    page.Canvas.DrawImage(img, x, 0, width, height);
                }                             
                pdfDoc.SaveToFile("11839.pdf");
            }

It took about 7 seconds on my computer. Due to the file's size(53 pages), it is difficult for us to do the optimization at present. Anyway, if there is any good way in the future, we will let you know.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Thu Oct 12, 2017 1:16 pm

Hello,

Thank you for looking into the issue at the earliest possible.
The conversion time reduced by 55% after using new code.

Thank you,
Raj Bhagat

rajbhagat.sit@gmail.com
 
Posts: 5
Joined: Fri Oct 30, 2015 12:00 pm

Fri Oct 13, 2017 2:54 am

Hello,

Thanks for your feedback.
Please feel free to contact us if there is any question.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Return to Spire.PDF