Bug 49808 - Setting accessibility in Java
Summary: Setting accessibility in Java
Status: CLOSED FIXED
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: pdf (show other bugs)
Version: 1.0
Hardware: PC Windows XP
: P2 blocker
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-23 08:44 UTC by jgreffe
Modified: 2012-03-28 06:33 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jgreffe 2010-08-23 08:44:41 UTC
When setting accessibility with :

A. userAgent.setAccessibility(true)

and then generating PDF, an exception occurs :

-----
ERROR org.apache.fop.area.AreaTreeModel - Error while rendering page 1
java.lang.NullPointerException
	at org.apache.fop.render.pdf.PDFPainter.prepareImageMCID(PDFPainter.java:152)
-----


It seems that logicalStructureHandler of PDFPainter is null.

The cause is that the logicalStructureHandler is set when calling :

B. FopFactory.newFop(String outputFormat, FOUserAgent userAgent, OutputStream stream)

which calls :

PDFDocumentHandler.startDocument()
where it tests accessibility of the attached FOUserAgent.

Issue is due to the fact that at the moment calling "B", we couldn't have correctly set "A" so, the logicalStructureHandler of PDFPainter remains null.




A solution is to change method FopFactory.setAccessibility() to public, so that we can set accessibility before calling "B".
Comment 1 jgreffe 2010-08-23 10:33:30 UTC
My mistake, this has already been managed :

FOUserAgent fopUserAgent = FopFactory.newFOUserAgent();
fopUserAgent.setAccessbility(true);
Fop fop = FopFactory.newFop(String outputFormat, fopUserAgent, OutputStream stream)