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 Jun 05, 2026 3:17 pm

Good Day Spire Team

We have a question in regards to pdfDocument.SaveAsImage(pageNumber, PdfImageType).
We are using Spire to load PDF files and then render the resulting Bitmap using WPF.

Depending on what is loaded, the SaveAsImage method takes quite a bit of time, especially when using a vector PDF (construction plan specifically).

What are your recommendations to optimize the performance?
Would there be a better option to render the PDF in WPF?

If required I can provide a PDF file that takes about 6 seconds to load.

All the best

sgerber
 
Posts: 30
Joined: Tue Nov 07, 2017 10:21 am

Mon Jun 08, 2026 3:12 am

Hello,

Thank you for reaching out to us.

Could you please let us know which version of Spire.PDF you are currently using? Also, to help us reproduce and investigate the performance issue, please share the specific PDF document along with the code you're using for the rendering.

Your assistance with this is greatly appreciated.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Mon Jun 08, 2026 5:23 am

Good Morning

The Spire.PDF Version used is 12.5.8.

I am able to supply a PDF, however I cannot upload it to the forum.
Is there any way to provide it more directly?

The test code is available below.

Code: Select all
var stopwatch = new System.Diagnostics.Stopwatch();
stopwatch.Start();

using (var pdfDocument = new PdfDocument(openFileDialog.FileName))
{
    var bitmapImage = pdfDocument.SaveAsImage(0, Spire.Pdf.Graphics.PdfImageType.Bitmap, 96, 96);
}

stopwatch.Stop();
System.Diagnostics.Debug.WriteLine($"Variant 1:   {stopwatch.ElapsedMilliseconds} ms    /    {stopwatch.ElapsedTicks} ticks");

sgerber
 
Posts: 30
Joined: Tue Nov 07, 2017 10:21 am

Mon Jun 08, 2026 5:38 am

Hello,

Thank you for your prompt reply.

Please send the requested PDF document and your code to our support email at mailto:[email protected].

Thank you for your assistance.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Mon Jun 08, 2026 6:31 am

Hi Amy,

I have sent an email containing code, short description and 3 PDFs attached.

sgerber
 
Posts: 30
Joined: Tue Nov 07, 2017 10:21 am

Mon Jun 08, 2026 8:29 am

Hello,

I’ve received your email. Thank you.

I tested the processing time for your three PDF documents using version 12.5.8.1360 in my local Windows 10 environment.

Here are the results:
00-erdgeschoss.pdf: 47ms to load the PDF; 947ms from loading to completing the image conversion.
PDF-Performance-Default.pdf: 50ms to load the PDF; 9,047ms from loading to completing the image conversion.
PDF-Performance-RGB.pdf: 45ms to load the PDF; 9,169ms from loading to completing the image conversion.

In your email, you mentioned that it took 700ms just to load the 00-erdgeschoss.pdf document. Could you please clarify if this 700ms refersonly to the execution time of var pdfDocument = new PdfDocument(file), or does it include the total time from loading the document all the way to completing the image conversion?

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3011
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF

cron