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