Jump to content

Recommended Posts

Posted

I am working on exporting jasper reports as PDF files. I use the following codes to make the exported file as tagged PDF.

******************************************************************

JRPdfExporter exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, out); exporter.setParameter(JRPdfExporterParameter.METADATA_TITLE, "Report");
exporter.setParameter(JRPdfExporterParameter.METADATA_SUBJECT, "Report");
exporter.setParameter(JRPdfExporterParameter.METADATA_AUTHOR, "My App");
exporter.setParameter(JRPdfExporterParameter.METADATA_KEYWORDS, "Report");
exporter.setParameter(JRPdfExporterParameter.IS_TAGGED, true);
exporter.setParameter(JRPdfExporterParameter.TAG_LANGUAGE, "English");
exporter.exportReport();

******************************************************************

However, my PDF report could not pass PDF Accessibility full check. I have two problems here. One is hyperlinks in reports are not tagged, and the other is images in reports do not have "Alt Text".

I found that all the textfields in jasper reports are exported and tagged as "Text" even if they have hyperlinks. So hyperlinks are not included in the tag tree.

And I could not figure out how to add "Alt Text" to an image which is rendered in jasperreports.

Could anybody here give me some help? Thanks.

  • 1 year later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Posted

I am facing the same issue with the link, as well as a new one related to tab order. Have not figure out how to set the tab order yet.

 

For images, you need to make them hyperlinks and add a tooltip to it... The tooltip becomes the ALT tag.

  • 1 year later...
Posted

Sorry to necropost here, but Google keeps bringing me to this page as an example of setting metadata and accessibility tagging.

I just wanted to note that the language tag above should probably use the syntax in RFC 3066 such as:

exporter.setParameter(JRPdfExporterParameter.TAG_LANGUAGE, "en");

or, use a region-specific variant such as 

exporter.setParameter(JRPdfExporterParameter.TAG_LANGUAGE, "en-US");

 

Posted

One more note on the alt tagging, if you go directly into the XML you can add the alt text without making the graphic a hyperlink:

 

<image hyperlinkTarget="Blank">
<reportElement x="0" y="0" width="111" height="93"/>
<imageExpression class="java.lang.String"><![CDATA["logo.png"]]></imageExpression>
<hyperlinkTooltipExpression><![CDATA["Company Logo"]]></hyperlinkTooltipExpression>
</image>
 
The alt text goes in the hyperlinkTooltipExpression tag.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...