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:
- Can the image XObjects under /Alternates be reached in any way using Aspose.Pdf?
- If so, how?
- If not, are there any plans for having that in the future?
You support in this topic would be greatly appreciated!
Best regards!