import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import org.apache.xmlgraphics.java2d.color.profile.ColorProfileUtil;
import org.apache.xmlgraphics.xmp.Metadata;
+import org.apache.xmlgraphics.xmp.schemas.DublinCoreSchema;
import org.apache.xmlgraphics.xmp.schemas.XMPBasicAdapter;
import org.apache.xmlgraphics.xmp.schemas.XMPBasicSchema;
Metadata docXMP = metadata.getMetadata();
Metadata fopXMP = PDFMetadata.createXMPFromPDFDocument(pdfDoc);
//Merge FOP's own metadata into the one from the XSL-FO document
- fopXMP.mergeInto(docXMP);
+ List<Class> exclude = new ArrayList<Class>();
+ if (pdfDoc.getProfile().getPDFAMode().isPart1()) {
+ exclude.add(DublinCoreSchema.class);
+ }
+ fopXMP.mergeInto(docXMP, exclude);
XMPBasicAdapter xmpBasic = XMPBasicSchema.getAdapter(docXMP);
//Metadata was changed so update metadata date
xmpBasic.setMetadataDate(new java.util.Date());
}
public StructureTreeElement startNode(String name, Attributes attributes, StructureTreeElement parent) {
- assert parent == null || parent instanceof PDFStructElem;
+ if (!isPDFA1Safe(name)) {
+ return null;
+ }
+ assert parent == null || parent instanceof PDFStructElem;
PDFStructElem parentElem = parent == null ? ancestors.getFirst() : (PDFStructElem) parent;
PDFStructElem structElem = createStructureElement(name, parentElem, attributes,
pdfFactory, eventBroadcaster);
}
public void endNode(String name) {
- ancestors.removeFirst();
+ if (isPDFA1Safe(name)) {
+ ancestors.removeFirst();
+ }
+ }
+
+ private boolean isPDFA1Safe(String name) {
+ return !(pdfFactory.getDocument().getProfile().getPDFAMode().isPart1()
+ && (name.equals("table-body")
+ || name.equals("table-header")
+ || name.equals("table-footer")));
}
public StructureTreeElement startImageNode(String name, Attributes attributes, StructureTreeElement parent) {