Converting images in PDF to JPEG makes resulting PDF bigger

I downloaded the new version 6.8.0.0 of aspose.pdf today hoping that my previous problem with images swapping places were fixed. And indeed it was :-) But now I have a new problem. When I use the following code to convert all images in a PDF to JPEG the resulting PDF grows from 14 to 22 MB. Do you have any idea why? When I compare the two PDFs I can se the jpeg compression in the large file, but the original file looks just fine. How on earth have they managed to make the original file take up less space with better looking images compared to the new one I generate?

        Public Shared Function ConvertPDFToPDF(ByRef inputStream As Stream) As MemoryStream
            Dim pdfDocument As New Aspose.Pdf.Document(inputStream)
        <span style="color: blue;">For</span> <span style="color: blue;">Each</span> page <span style="color: blue;">As</span> Aspose.Pdf.<span style="color: rgb(43, 145, 175);">Page</span> <span style="color: blue;">In</span> pdfDocument.Pages
            <span style="color: blue;">Dim</span> idx <span style="color: blue;">As</span> <span style="color: blue;">Integer</span> = 1
            <span style="color: blue;">For</span> <span style="color: blue;">Each</span> image <span style="color: blue;">As</span> Aspose.Pdf.<span style="color: rgb(43, 145, 175);">XImage</span> <span style="color: blue;">In</span> page.Resources.Images
                <span style="color: blue;">Using</span> imageStream <span style="color: blue;">As</span> <span style="color: blue;">New</span> <span style="color: rgb(43, 145, 175);">MemoryStream</span>()
                    image.Save(imageStream, System.Drawing.Imaging.<span style="color: rgb(43, 145, 175);">ImageFormat</span>.Jpeg)
                    page.Resources.Images.Replace(idx, imageStream)
                    idx = idx + 1
                <span style="color: blue;">End</span> <span style="color: blue;">Using</span>
            <span style="color: blue;">Next</span>
        <span style="color: blue;">Next</span>
        <span style="color: blue;">Dim</span> outputStream <span style="color: blue;">As</span> <span style="color: blue;">New</span> <span style="color: rgb(43, 145, 175);">MemoryStream</span>()
        pdfDocument.Save(outputStream)
        <span style="color: blue;">Return</span> outputStream
    <span style="color: blue;">End</span> <span style="color: blue;">Function</span></pre><pre style="background: white; color: black; font-family: Consolas;"><span style="color: blue;"></span> </pre>

Hi Bjarke,

Thank you for the sample code and template file.

I am able to notice the problem regarding increase in file size. I have logged your issue in our issue tracking system with issue id:PDFNEWNET-33374 for our development team to investigate. You will be notified regarding any updates via this forum thread.

Sorry for the inconvenience,

The issue doesn’t seem to be solved in version 6.9.0.0 of apsose.pdf. Do you have any idea when this bug will be fixed?

Hi Bjarke,

Thanks for your patience.

I have verified the status of this issue from our issue tracking system and regret to share that this issue is still unresolved. Currently it is pending for analysis and is in the queue. Also, at the moment we can't provide you the ETA for this issue. However, I have requested the development team to share the ETA regarding its resolution. As soon as we get required information, we will be more than happy to update you with the status of correction. Please be patient and spare us little time.

We apologize for your inconvenience.

Thanks & Regards,

Hi,


Do you know ETA for this bugfix? It’s now more than 2 months ago I reported the problem - I think you should be able to come up with an ETA by now.

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

Thank you for being patient.

I am pleased to inform you that your reported issue has been fixed and the fix will be a part of our upcoming release of Aspose.Pdf for .NET v7.0. The release is currently in testing and will be released in a few days time. You will be notified via this forum thread once the new version is available for download.

Sorry for the inconvenience,

I’m still waiting for the release - do you have a new ETA?

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

Sorry for the inconvenience,

We are currently testing Aspose.Pdf for .NET 7.0.0 and hopefully we will release the version by the end of this week. Actually, there have been some requests for the resolution of priority support issues, so we had to rebuild the release after including those fixes. We are working on the testing of the release on high priority to make it available for download as soon as possible. We will notify you once the release is available for download.

Again, we are sorry for any delay and inconvenience,