Hi
We're using the LayerUtility class to copy a page from one PDF in to a page in
a different PDF. Mostly, it has worked well up until now. However, when
checking ADA compliance, we noticed the alternative text is not copied over to
the target PDF page.
I've tried two variations, but neither copy the Alternative text (/Alt token)
PDFormXObject firstForm = layerUtility.importPageAsForm( fromDoc,
fromPage );
PDPage targetPage = targetDoc.getPage( targetPageIndex );
AffineTransform af = new AffineTransform( );
layerUtility.wrapInSaveRestore( targetPage );
layerUtility.appendFormAsLayer( targetPage, firstForm, af, "unique name
generated here" );
and
PDFormXObject firstForm = layerUtility.importPageAsForm( fromDoc,
fromPage );
PDPage targetPage = targetDoc.getPage( targetPageIndex );
try( PDPageContentStream pdfDocPageContents = new PDPageContentStream(
targetDoc, targetPage, AppendMode.PREPEND, true, false ); ) {
pdfDocPageContents.drawForm( firstForm );
}
My low-level PDF foo is very small, so currently am at a bit of a loss.
Can anyone make any suggestions? Give me code examples of a working copy for
/Alt? Confirm that it's not possible? Anything to help open my eyes.
Many thanks
Mark