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

Free Support Forum - aspose.com

Images referenced using /Alternates in PDF not getting listed

Hi,

Short description:
pdfDocument.Pages.First().Resources.Images does not list image XObjects referenced using /Alternates, and so far I’ve found no other way of reaching those using Aspose.PDF 21.6.0.0

Long version:
According to section 8.9.5.4 on page 211 of [the first edition of the PDF reference](https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf), an image stored as an XObject can have multiple representations of itself - e.g. one for on-screen display and another for printing with higher resolution - under its /Alternates entry, by referencing an object with an array of alternate image dictionaries.
I managed to create such a PDF file that uses this feature based on the example found on page 212 of said guide, where an alternative image is used for printing.
pdf_alternates_test.pdf (7.5 KB)

I “forged” it in a way so when printed, the text “Printed Image” is shown, as opposed to simply opened, where “Original Image” can be seen, hence it is easy to distinguish which one is used at any moment. I must mention that out of 4 PDF viewers (Chromium, Firefox, Evince, Adobe Acrobat Reader DC) only one managed to actually respect the /Alternates field during print, the others printed the image intended for screen display.
Here is the Acrobat Reader printed version of the file:
printed_adobe.pdf (4.3 KB)

Finally, I tried to reach all the images in this file using the following:

Aspose.Pdf.Document doc = new Aspose.Pdf.Document("pdf_alternates_test.pdf");

foreach (var image in doc.Pages.First().Resources.Images)
{
System.Console.WriteLine($"{image.Name}: {image.ToStream().Length}");
}

However, based on the content size, I could tell that only the on-screen version of the image was listed, and I wasn’t able to access its printed counterpart in any way so far.

All-in-all my questions would be:

  1. Can the image XObjects under /Alternates be reached in any way using Aspose.Pdf?
  2. If so, how?
  3. If not, are there any plans for having that in the future?

You support in this topic would be greatly appreciated!

Best regards!

@psimon

We were able to notice the similar behavior by the API at our end. This whole case needs detailed investigation in order to determine the feasibility of your requirements. Hence, an issue as PDFNET-50270 has been logged in our issue tracking system for the sake of analysis. We will look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi,
Is there any news regarding this issue?

@lorbanops

Sadly, there are no updates regarding ticket resolution at the moment. There were other issues in the queue which were logged previously than this ticket and we resolve issue on first come first serve basis. As soon as we have some updates regarding issue fix, we will let you know. Please spare us some time.

We are sorry for the inconvenience.