Aspose.PDF call to JpegDevice.Process() is slow for large PDF files

I am experiencing poor performance when converting a large PDF to JPEG using [JpegDevice.Process()](http://www.aspose.com/docs/display/pdfnet/JpegDevice+Process+Method).

A PDF file with 145 pages @ 140MB takes around 10 minutes to convert all the pages to JPEG.

This is when using Aspose.PDF 7.6.0.0.

Is there anything I can do to improve performance of the call to JpegDevice.Process() for large files?

Hi Kevin,


Thanks for your inquiry. I am afraid you are using a quite older version of Aspose.Pdf. We will appreciate if you please download and try latest version of Aspose.Pdf, as with the time we have made number of fixes and enhancement in the API. Hopefully it will help you to accomplish the task.

We are sorry for the inconvenience caused.

Best Regards,

Thanks for your suggestion. I upgraded from 7.6.0.0 to 9.3.0.0 and the load time for a 145 page 150MB PDF went from 3min 48sec to 2min (47% off). That’s pretty good, but I’m wondering if I can get ever better performance, since 120 seconds is still unacceptable as an end user.




Here is a sample of the code that calls JpegDevice.Process(). I have run this code through RedGate ANTS Performance Profiler, to determine that JpegDevice.Process() is taking up >90% of the execution time.



Dim pdfDocument As Aspose.Pdf.Document = New Aspose.Pdf.Document(strPDFPath)
For pageCount As Integer = 1 To pdfDocument.Pages.Count
	strImgUrl = "DATASTORE/img" & pageCount & ".jpg"
	strbindImgUrl = "/Pdf.aspx?ImgPath=" & strImgUrl
	Using imageStream As New FileStream(strImgUrl, FileMode.Create)
		Dim resolution As New Devices.Resolution(300)
		Dim rect As Rectangle = pdfDocument.Pages(pageCount).GetPageRect(True)
		Dim jpegDevice As New Devices.JpegDevice(rect.Width, rect.Height, resolution, 100)
		jpegDevice.Process(pdfDocument.Pages(pageCount), imageStream)
		imageStream.Close()
		Dim cntrImg As New System.Web.UI.WebControls.Image()
		cntrImg.ID = pageCount & "_img"
		cntrImg.ImageUrl = strbindImgUrl
		images.Controls.Add(cntrImg)
	End Using
Next pageCount

Hi Kevin,


Thanks for sharing the details.

Can you please share the source PDF so that we can test the scenario at our end. We are sorry for this inconvenience.