XLSX to PDF: Image repeating on every page

I’m trying to convert a spreadsheet to a PDF using the attached program file. The resulting pdf looks fine when I look at it in a viewer. The problem is that later in my application I need to programatically access all of the images in the resulting pdf. It appears that the image that is in the top left corner of the spreadsheet is in the XImages collection of every single page of the pdf. My attached sample program demonstrates this by looping through each page’s images collection and then hashing the image and printing the hash to the console. Every page has 1 image, and all of the images have the same hash.


Thanks

Hi Kerby,

Thanks for your posting and using Aspose.Cells and Aspose.PDF.

Please provide us some runnable application project instead. Please use the latest version Aspose.Cells for .NET 8.2.2 and Aspose.Pdf for .NET 9.7.0 inside your project. We will run your project at our end and investigate this issue.

In case, there is some bug, we will log it in our database so that it could be fixed as soon as possible.

Attached is a fully functional solution.

Hi Kerby,

Thanks for your sample project and using Aspose.Cells and Aspose.PDF.

We were able to observe this issue after running your sample project. If the PDF is saved by Excel, then image does not repeat, but if the PDF is saved by Aspose.Cells, it does repeat.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-43093 - XLSX to PDF: Image repeating on every page

Hi Kerby,

Thanks for using Aspose.Cells.

We have evaluated this issue further and found out this is not bug but a behavior of Aspose.Cells.

We write references of all resources to pdf pages. So the resources that
you get from a page are all the resources of the pdf file. So if you
want to get all images of the pdf file, just get images of one page.

Shakeel,


Thanks for your response. Unfortunately I need to know which specific page each image is on. So having all images on all pages will not work for my requirements. Is there a way that I can see which images are visible on a specific page?

Thanks,
Kerby

Hi Kerby,

Thanks for you posting and using Aspose.Cells.

We have logged your comments in our database against this issue. We will look into it and advise you. If there is any workaround for you, we will let you know. Please spare us some time. Once, there is some news for you, we will share it with you asap.

Again, thank you for your response, Shakeel. I was going through the Aspose PDF documentation and stumbled on the ImagePlacementAbsorber class. This can be used to get the images of a single page, and this effectively resolves my remaining issues.


Regards,
Kerby

Hi Kerby,

Thanks for your posting and using Aspose.Cells.

Since, the generated pdf can show correctly in pdf. We think the you may ask for Aspose.Pdf team for this (Is there a way that I can see which images are visible on a specific page?).

It is good to know that you have found the solution of your problem. In case, you find problem, please feel free to post in Aspose.Pdf forum to get help in this regard.

We will look into your issue and help you asap.