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.

Wed Sep 09, 2020 8:59 am

I want to convert all pages of a pdf into image..Currently I got a file that took long time to convert.. About 30s for each page.. May I know what is the problem and how to optimize it? Here I attached the problem file and code that I used to convert ..

Code: Select all
PdfDocument pdffile.LoadFromFile(file);
var pageNumber = pdffile.Pages.Count;
for (int i = fromPage; i < pageNumber && i <= untilPage; i++)
{
       Image images = pdffile.SaveAsImage(i);
       var target =  "Page_" + i.ToString();
       var pngTarget = Path.ChangeExtension(target, "png");
       images.Save(pngTarget, ImageFormat.Png);
}

xiao0207
 
Posts: 43
Joined: Thu Dec 13, 2018 9:50 am

Wed Sep 09, 2020 10:01 am

Hello,

Thanks for your inquiry.
I did an initial test with the latest Spire.Office Platinum(Hotfix) Version:5.8.5, but it took about 10s to convert each page to image. And it took about 110s to convert all the pages to images in total. If you are using an older version, I recommend you try again with the latest version.

If there is not much improvement after trying, please provide the following information to help us investigate further.

1) Your OS information and region setting, e.g. Win7 64 bit, China/Chinese.
2) Your project type and the target framework, e.g. Console Application, .NET Framework 4.5.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri Sep 11, 2020 6:13 am

Hello,

Greetings from E-iceblue!
How is your issue now? Could you please give us some feedback at your convenience?
Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Fri Mar 05, 2021 10:33 am

Hi..Sorry for not getting back to you..I try to convert this file using the Spire pdf 7.1.10.2040..It took me about 110second to finish..which is still acceptable.. but may I know what is the factor that causing it took longer in the conversion? cause I got some file is 100 pages but convert faster than this 10 pages file..

xiao0207
 
Posts: 43
Joined: Thu Dec 13, 2018 9:50 am

Mon Mar 08, 2021 1:50 am

Hello,

Thanks for your response.
I tested your case with the latest Spire.PDF and did find it took about 110 seconds to finish the conversion. The main reason that causes the conversion to take so long is that your PDF contains complex images.

Anyway, I have posted this issue to our Dev team to investigate whether it can be optimized. If there is any good news, we will let you know. Sorry for the inconvenience caused.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Tue Feb 28, 2023 7:52 am

Hi Rachel,

Is there any update on this ?

Best regards

xiao0207
 
Posts: 43
Joined: Thu Dec 13, 2018 9:50 am

Tue Feb 28, 2023 9:59 am

Hello,

Thanks for your following-up.
This is Abel from E-iceblue.
I created a console project with NetFrameWork4.8 and the latest version of Spire.Office to test your issue, I found that the conversion time had been reduced to 36s. You can install the latest version of Spire.Office 8.2.2 through Nuget and test your issue.
If you have any issue, just feel free to contact us.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 951
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.PDF