File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed
test/java/org/apache/fop/pdf Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,9 @@ public List<PDFObject> getKids() {
267267 }
268268
269269 public int output (OutputStream stream ) throws IOException {
270+ if (structureType == StandardStructureTypes .InlineLevelStructure .NOTE ) {
271+ put ("ID" , "Note ID " + getObjectNumber ().getNumber ());
272+ }
270273 if (getDocument () != null && getDocument ().getProfile ().getPDFUAMode ().isEnabled ()) {
271274 if (entries .containsKey ("Alt" ) && "" .equals (get ("Alt" ))) {
272275 put ("Alt" , "No alternate text specified" );
Original file line number Diff line number Diff line change @@ -94,8 +94,8 @@ public class PDFStructureTreeBuilder implements StructureTreeEventHandler {
9494 addBuilder ("basic-link" , new LinkBuilder ());
9595 // Out-of-Line Formatting Objects
9696 addBuilder ("float" , StandardStructureTypes .Grouping .DIV );
97- addBuilder ("footnote" , StandardStructureTypes .InlineLevelStructure .NOTE );
98- addBuilder ("footnote-body" , StandardStructureTypes .Grouping . SECT );
97+ addBuilder ("footnote" , StandardStructureTypes .InlineLevelStructure .REFERENCE );
98+ addBuilder ("footnote-body" , StandardStructureTypes .InlineLevelStructure . NOTE );
9999 // Other Formatting Objects
100100 addBuilder ("wrapper" , StandardStructureTypes .InlineLevelStructure .SPAN );
101101 addBuilder ("marker" , StandardStructureTypes .Grouping .PRIVATE );
Original file line number Diff line number Diff line change @@ -91,4 +91,31 @@ private ByteArrayOutputStream foToOutput(String fo)
9191 transformer .transform (src , res );
9292 return bos ;
9393 }
94+
95+ @ Test
96+ public void testFootnote () throws Exception {
97+ String fo = "<fo:root xmlns:fo=\" http://www.w3.org/1999/XSL/Format\" >\n "
98+ + " <fo:layout-master-set>\n "
99+ + " <fo:simple-page-master master-name=\" simple\" page-height=\" 27.9cm\" page-width=\" 21.6cm\" >\n "
100+ + " <fo:region-body />\n "
101+ + " </fo:simple-page-master>\n "
102+ + " </fo:layout-master-set>\n "
103+ + " <fo:page-sequence master-reference=\" simple\" >\n "
104+ + " <fo:flow flow-name=\" xsl-region-body\" >\n "
105+ + " <fo:block>Text<fo:footnote>\n "
106+ + " <fo:inline>1</fo:inline>\n "
107+ + " <fo:footnote-body>\n "
108+ + " <fo:block>footnote</fo:block>\n "
109+ + " </fo:footnote-body>\n "
110+ + " </fo:footnote>\n "
111+ + " </fo:block>\n "
112+ + " </fo:flow>\n "
113+ + " </fo:page-sequence>\n "
114+ + "</fo:root>\n " ;
115+ ByteArrayOutputStream bos = foToOutput (fo );
116+ String pdf = bos .toString ();
117+ Assert .assertTrue (pdf .contains ("/ID (Note ID " ));
118+ Assert .assertTrue (pdf .contains ("/S /Note" ));
119+ Assert .assertTrue (pdf .contains ("/S /Reference" ));
120+ }
94121}
You can’t perform that action at this time.
0 commit comments