Hello,
I'm using Aspose.Pdf to extract and replace all the images in PDF files.
To extract the images, I'm using PDFExtractor.ExtractImage() with HasNextImage() and GetNextImage().
And to replace these images after a treatment to reduce their weight, I'm using PDFDocument.Pages[].Resources.Images.Replace() method.
To get the images index, I've a counter in a loop which starting with 1.
I've this exception message when I try to replace images : "Invalid index: index should be in the range [1..n] where n equals to the images count".
And analyze the two image's collections: the PDFExtractor's images collection have 2 images and the PDFDocument images collection have 1 image for exemple, so I can't have the same image index and I can't replace images.
Please find attached a sample application (copy first the pdf file at the root of the zip file into the folder where the exe file will be outputed)
I'm using Aspose PDF 8.8.
Best Regards
I'm using Aspose.Pdf to extract and replace all the images in PDF files.
To extract the images, I'm using PDFExtractor.ExtractImage() with HasNextImage() and GetNextImage().
And to replace these images after a treatment to reduce their weight, I'm using PDFDocument.Pages[].Resources.Images.Replace() method.
To get the images index, I've a counter in a loop which starting with 1.
I've this exception message when I try to replace images : "Invalid index: index should be in the range [1..n] where n equals to the images count".
And analyze the two image's collections: the PDFExtractor's images collection have 2 images and the PDFDocument images collection have 1 image for exemple, so I can't have the same image index and I can't replace images.
Please find attached a sample application (copy first the pdf file at the root of the zip file into the folder where the exe file will be outputed)
I'm using Aspose PDF 8.8.
Best Regards