Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Aug 02, 2018 4:17 am

First Replace is no problem. but it cause exception from second so on.(case of multiple image on the page,System.ArgumentException)
and after search few article, i've found there are hotfix about this. (4.7.11)

the hotfix says 'Fixes the issue that caused an ArgumentException when replacing image on PDF.'
im pretty sure that'll fix my problem. but the hotfix doesn't make differences.
i've tried .net dll and wpf dll. nothing changed.
am i miss something?

dahami
 
Posts: 21
Joined: Thu Jun 28, 2018 4:39 am

Thu Aug 02, 2018 6:11 am

Hello,

Thanks for your inquiry.
To help us look into your issue accurately, please provide below resources. Thanks in advance.
1) your input Pdf file.
2) your code fragment.
3) the image that you used to do replacement.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Thu Aug 02, 2018 6:54 am

I was think All Pdf's is going to be happen this. but i was wrong.

the Source isn't problem. because it'll be appear from your sample code.

[url]https://www.e-iceblue.com/Tutorials/Spire.PDF/Spire.PDF-Program-Guide/Document-Operation/How-to-Compress-PDF-Document-in-C-VB.NET.html
[/url]

but if you wanna see my test code , that's no problem at all

Code: Select all
            //Loads the PDF document
            PdfDocument doc = new PdfDocument(AppDomain.CurrentDomain.BaseDirectory + "Booklet.pdf");
            //Disables the incremental update
            doc.FileInfo.IncrementalUpdate = false;

            try
            {
                //Traverses all pages
                foreach (PdfPageBase page in doc.Pages)
                {
                    //Extracts images from page
                    Image[] images = page.ExtractImages();
                    if (images != null && images.Length > 0)
                    {
                        //Traverses all images
                        for (int j = 0; j < images.Length; j++)
                        {
                            Image image = images[j];
                            PdfBitmap bp = new PdfBitmap(image);
                            //Reduces the quality of the image
                            bp.Quality = 20;
                            //Replaces the old image in the document with the compressed image
                            page.ReplaceImage(j, bp);
                        }
                    }
                }
            }
            catch(Exception err)
            {
                System.Diagnostics.Trace.WriteLine(err.Message);
            }
            //Saves and closes the resultant document
            doc.SaveToFile("Output.pdf");
            doc.Close();


if i change pdf file to "CompressDocument.pdf" then, there's no problem.
thanks for fast feedback.
and i hope fast feedback this time too.

dahami
 
Posts: 21
Joined: Thu Jun 28, 2018 4:39 am

Thu Aug 02, 2018 8:05 am

Hello,

Thanks for your details.
I reproduced the issue you mentioned while testing the Booklet.pdf with your code. The issue has been logged into our bug tracking system. If it is fixed or there is any update, we will notify you. Apologize for the inconvenience caused.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Fri Aug 10, 2018 9:11 am

Hi,

Thanks for your patient waiting.
The reported issue has been fixed, please download the hotfix from following link.
Spire.PDF Pack(Hot Fix) Version:4.8.5

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Sun Aug 12, 2018 11:36 pm

i've check the hotfix again. and glad the solve that problem. :P

dahami
 
Posts: 21
Joined: Thu Jun 28, 2018 4:39 am

Mon Aug 13, 2018 1:27 am

Hi,

I'm delighted to hear that.
If you need assistance in the future, just feel free to contact us.
Have a nice day!

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.PDF