Hi,
I have encountered a problem while trying to transform a PowerPoint to PDF with the UA compliance using Aspose.Slides for Java (25.4). When trying out the result, a screen reader is not able to detect pictures or their alt-texts. By inspecting the accessibility content using Firefox inspector I can see clear differences between the generated layout from Aspose and PowerPoint.
Following the documentation I use the following code to transform the presentation:
Presentation pres = null;
PdfOptions options = new PdfOptions();
options.setCompliance(PdfCompliance.PdfUa);
try (FileInputStream is = new FileInputStream(fileIn);
FileOutputStream os = new FileOutputStream(fileOut)) {
pres = new Presentation(is);
for (var slide : pres.getSlides()) {
for (var shape : slide.getShapes()) {
if (shape instanceof PictureFrame) {
if (ShapeType.NotDefined == ((PictureFrame) shape).getShapeType()) {
((PictureFrame) shape).setShapeType(ShapeType.Rectangle);
}
}
}
}
pres.save(os, SaveFormat.Pdf, options);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (pres != null) pres.dispose();
}
Additionally, I had to add some fallback code for the shape type as it is not set on the image by default and I figured out that Aspose won’t set the alternate text if the shape type is not defined.
I have attached both result PDFs whereof one is generated by Aspose and one by PowerPoint.
clean-sample-by-aspose.pdf (829.2 KB)
clean-sample-by-powerpoint.pdf (173.1 KB)
Does someone know how to enforce a more PowerPoint like structure or at least a structure so a screen reader will pick up the alt-text on the images? Currently they seem to be ignored completely.
Thanks in advance!