Extracting the First Image in PDF - Extremely Slow Performance

We are using the Aspose.PDF .NET, the latest version. (Just bought it). All we need is to extract the first image in PDF (to use as a thumbnail - converting the page to image is a better approach of course, but that is even slower) and we do have a serious performance problem. Below is the description:

I have a single page PDF file; and I open it with aspose.pdf​

then all I do is to get teh first image in file, and save it as jpg to a memorystre​am

just the first image.. it is a 80kb image

the save operation takes about 2-3 secs... (correction : it takes more than 5 seconds!) This long duration makes it unusable for us. Below is the code for this test:

--------------

Dim pdfDoc As New Aspose.Pdf.Document("D:\test.pdf")

Dim xImage As XImage = pdfDoc.Pages(1).Resources.Images(1)
Dim ms As New System.IO.MemoryStream
Dim thumb_name As String = "D:\test_res.jpg"

xImage.Save(ms, Imaging.ImageFormat.Jpeg) '--> this operation consumes %99 percent of 2-3 seconds
Dim img As System.Drawing.Image = System.Drawing.Image.FromStream(ms)
ms.Close()
ms.Dispose()

--------------------

I am also attaching the test PDF we are using.

Please advise ASAP, this is a really urgent issue for us.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.Pdf.

I have tested your scenario with the template file you shared and found the issue regarding performance while image extration from Pdf file. I have logged your reported issue in our issue tracking system (with issue id: PDFNEWNET-29806) for our development team to further investigate it. We will get back to you as soon as we have any update regarding this issue.

Thank You & Best Regards,

Please also be informed that the same performance issue exists while converting a single page to jpg using JpegDevice. It also consumes more than 5 secs on a quite strong computer.


I hope the resolution comes up quickly; since we need to go live very very soon. Any quick response will be highly appreciated.

Thanks in advance.

Hi,

Thanks for using our products.

I have further tested the scenario while converting the PDF document(shared in your first post) and as per my observations, the conversion process is taking much time. For the sake of correction, I have logged this issue as PDFNEWNET-29811 in our issue tracking system. We will further look into the details of this problem and see how we can further improve our product’s performance. Please be patient and spare us little time. Soon you will be updated with the status of correction. We apologize for your inconvenience.

Hi, any news on this?

Can you provide a time frame for this issue? We are now late for couple of days for going live; and if it will take a long time to fix this, we will switch to another library. One way or another, we have to go live very very soon; we are already late.

Thanks for any quick respose.

Alp.

Hi,

Thanks for your patience.

<span style=“font-size: 10pt; font-family: “Tahoma”,“sans-serif”;”>
Our development team is working hard to get these issues fixed but I am afraid they not yet completely resolved. Nevertheless, I have requested the team to share
the ETA regarding their resolution. Soon you will be updated with the status of
correction.



Your patience and comprehension is greatly appreciated in this regard. <span style=“font-size:10.0pt;
font-family:“Tahoma”,“sans-serif””>We apologize for your inconvenience.<span style=“font-size:10.0pt;font-family:“Arial”,“sans-serif””>

Any news on this issue?

Hi,

Thanks for your patience.

We have made some progress towards the resolution of these problems and have been able to figure out the root cause of these issues. However I am afraid the problems are not yet completely resolved and its pretty difficult to estimate the exact timelines by which they will be fixed. As soon as we have some definite news regarding their resolution, we would be more than happy to update you with the status of correction.

We are really sorry for this inconvenience. Thanks for your cooperation and understanding.

It has been a couple of weeks since your last update on this issue. Any idea when you can release a fix? I should really like to have this up and going within the next couple of weeks.

Hi,

Thanks for your patience.

I am pleased to share that the issues reported earlier have been resolved and we expect to include their HotFix in upcoming release version. The new version Aspose.Pdf for .NET 6.2.0 is in testing phase and we expect to release it in next few days. Please be patient and spare us little time. We apologize for your inconvenience.

I am also having the same problem but with jpegDevice. It takes way to long to save the image.

Dim PDFDoc As New Aspose.Pdf.Document("file")

Dim PDFPage As Page = PDFDoc.Pages(1)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Dim resolutionLarge As New Resolution(100)

Dim jpegDeviceLarge As New JpegDevice(resolutionLarge,
80)

jpegDeviceLarge.Process(PDFPage, “file”.jpg")

Thanks.

Hi Joseph,

Thanks for using our products.

As I have stated earlier in this forum thread, we are planning to release a new version within this week and we have tried our level best to overcome this problem. Please wait for the new release and try using it. In case you still face any problem or you have any further query, please feel free to contact. We apologize for your inconvenience.

The issues you have found earlier (filed as 29806;29811) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

I have upgraded to version 6.2 and the exact same problem is still there. The performance is as bad as the previous version.

We have been waiting for this release for weeks; now disappointed.

Please advise as soon as possible.

I would agree… It’s still to slow.

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for your feedback. As per our testing with Aspose.Pdf for .NET v6.1, the time it took to convert your template file to an image file was 11.2 seconds and now with v6.2 it is reduced to around 6 seconds. We understand that 6 seconds is still not a satisfactory time and we will continue to look into this issue to improvement the performance. I have re-opened the issue and we will update you as soon as there is any feedback from the development team.

We are really sorry for the inconvenience caused,

Hi,

Adding more to Nausherwan’s comments, I have also tested the scenario related to first image extraction (originally logged as PDFNEWNET-29806) and as per my observations, the image extraction is taking around 3.08 Seconds. The issue is again marked as unresolved and has been communicated to the development team. They will further investigate on how we can further improve its performance.

Concerning to conversion of page into Image format (originally logged as PDFNEWNET-29811), I have observed that the conversion process is taking around 3.28 Seconds when tested over Windows 7 X64 on Intel Corei5 2.8GHz with 8GB of RAM. Nevertheless, it has already been marked as unresolved and development team has been intimated to further investigate the possibilities for improving the performance related to this feature. Please spare us little time and we will get back to you soon. We are really sorry for the regression issues.

My problem is not just "converting" to JPG. Even while extracting the first image in the file takes quite long time; that is not rendering as image; but just to extract the existing image. For instance, with iTextSharp, the same is done in a fraction of second; but with Aspose, it is done in more than 4-5 secs.

Hi,

As I have shared earlier, we will try our level best to improve the performance in terms of both image Extraction and Image conversion feature and will keep you posted on the status of correction. Please be patient and spare us little time. Your patience and comprehension is highly esteemed in this regard.

Once again, please accept our humble apologies for this inconvenience.

is there any update/ETA on the fix for the related performance issues.

Thanks