Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
If a table cell has the role TH it gets a scope info as PDF tag attribute (Entry A) with the name /Scope and a value Column (default), Row or Both.
This works fine, but if the fo:table-cell has an additional number-columns-spanned attribute, the Scope info is lost.
The attached FO document (scope-with-colspan.fo) shows two table head cells only one with number-columns-spanned=2.
The screenshot shows the tag property view in Acrobat of the rendered PDF (scope-with-colspan.pdf) for both cells.
One has the ColSpan attribute but no Scope info:
The other with no ColSpan attribute has the Scope info:
The reason for the behavior of FOP is that the scope is written directly as "A"-Entry:
static void addScopeAttribute(PDFStructElem th, Scope scope) { PDFDictionary scopeAttribute = new PDFDictionary(); scopeAttribute.put("O", Table.NAME); scopeAttribute.put("Scope", scope.getName()); th.put("A", scopeAttribute); }
Source: StandardStructureAttributes.java:58
But the colspan/rowspan attributes are collected as a special attribute field of PDFStructElem:
public void setTableAttributeColSpan(int colSpan) { setTableAttributeRowColumnSpan("ColSpan", colSpan); } public void setTableAttributeRowSpan(int rowSpan) { setTableAttributeRowColumnSpan("RowSpan", rowSpan); } private void setTableAttributeRowColumnSpan(String typeSpan, int span) { PDFDictionary attribute = new PDFDictionary(); attribute.put("O", Table.NAME); attribute.put(typeSpan, span); if (attributes == null) { attributes = new ArrayList<PDFDictionary>(2); } attributes.add(attribute); }
Source: PDFStructElem.java:230
At the end the field attribute overwrites the "A"-Entry:
private void attachAttributes() { if (attributes != null) { if (attributes.size() == 1) { put("A", attributes.get(0)); } else { PDFArray array = new PDFArray(attributes); put("A", array); } } }
Source: PDFStructElem.java:174
I will see If I can produce a patch in the next days.