We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Really slow PDF to image performance

Systems tried: Windows 7 64bit, 8GB RAM, Core i7 4700MQ
Hyper-V VM with Windows 2008R2 64bit, 8GB RAM, E5640 Xeon
.NET Version 4.5.2
Aspose.Pdf version 9.7

We are trying to consolidate all of our PDF processing into Aspose.Pdf. Converting PDF to images takes a lot of time. For the attached file PDFNet takes 2.3 seconds and Aspose.Pdf takes 17 seconds to convert the PDF to images while consuming 25% more CPU (over a longer period of time) and consuming 5 times the amount of memory.

Code sample is bellow. Over 99% of the below function was spent on the

bmpDevice.Process(_doc.Pages[pageNumber], stream); line

public Bitmap GetPageImage(int pageNumber)
{
Resolution resolution = new Resolution(95);
BmpDevice bmpDevice = new BmpDevice(resolution);
        <span style="color:blue;">using</span> (<span style="color:blue;">var</span> stream = <span style="color:blue;">new</span> <span style="color:#2b91af;">MemoryStream</span>())
        {
            bmpDevice.Process(_doc.Pages[pageNumber], stream);
            <span style="color:blue;">var</span> imgBytes = stream.ToArray();
            <span style="color:blue;">var</span> converter = <span style="color:blue;">new</span> <span style="color:#2b91af;">ImageConverter</span>();
            <span style="color:#2b91af;">Bitmap</span> bitmap = (<span style="color:#2b91af;">Bitmap</span>)converter.ConvertFrom(imgBytes);

            <span style="color:blue;">return</span> bitmap;
        }
    }

    <span style="color:blue;">public</span> <span style="color:#2b91af;">List</span><<span style="color:#2b91af;">Bitmap</span>> GetPageImages()
    {
        <span style="color:#2b91af;">List</span><<span style="color:#2b91af;">Bitmap</span>> bitmaps = <span style="color:blue;">new</span> <span style="color:#2b91af;">List</span><<span style="color:#2b91af;">Bitmap</span>>();
        <span style="color:blue;">for</span> (<span style="color:blue;">int</span> pageNum = 1; pageNum <= _doc.Pages.Count; pageNum++)
        {
            bitmaps.Add(GetPageImage(pageNum));
        }
        <span style="color:blue;">return</span> bitmaps;
    }</pre>Thank you.<br>

Hi Michael,


Thanks
for using our API’s.
<o:p></o:p>

I
have tested the scenario and have observed that PDF to Image conversion completes in 28 seconds on Intel Core i5 2.5 Ghz with 4GB of RAM. I am able to notice the same problem. For the sake
of correction, I have logged this problem as PDFNEWNET-37732 in
our issue tracking system. We will further look into the details of this
problem and will keep you updated on the status of correction. Please be
patient and spare us little time. We are sorry for this inconvenience.

Is there a target date for addressing this issue? Also what happened to the original forum post? I am only seeing a reply.

Hi Michael,


Thanks for contacting support.

I am afraid the earlier reported issue is not yet resolved. However I have requested the team to investigate this issue and share the possible ETA. As soon as we have some further updates, we will let you know. We are sorry for this inconvenience.

Now concerning to forum forum posts accessibility, we are in coordination with respective team and will keep you posted on the status of correction.

We are sorry for this delay and inconvenience.

Hi Michael,


We have further investigated the forum thread access issue and you should be now able to see the post describing original problem. Should you have any further query, please feel free to contact.

The issues you have found earlier (filed as PDFNET-37732) have been fixed in Aspose.PDF for .NET 19.1.