aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache
diff options
context:
space:
mode:
authorSimon Steiner <ssteiner@apache.org>2014-08-21 14:42:22 +0000
committerSimon Steiner <ssteiner@apache.org>2014-08-21 14:42:22 +0000
commit967a5b18472f2f13db29dcff59b06aaedcc52b76 (patch)
treecdaabc77d03f1a4090aec0d78838ad7f87798d56 /src/java/org/apache
parent24675249db03c7a4ed6b8770fdffa5f64de496cf (diff)
downloadxmlgraphics-fop-967a5b18472f2f13db29dcff59b06aaedcc52b76.tar.gz
xmlgraphics-fop-967a5b18472f2f13db29dcff59b06aaedcc52b76.zip
FOP-2353: PDF-A preflight warnings
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1619415 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java8
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java16
2 files changed, 21 insertions, 3 deletions
diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java b/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java
index ef4824c6a..111cca6b2 100644
--- a/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java
+++ b/src/java/org/apache/fop/render/pdf/PDFRenderingUtil.java
@@ -26,6 +26,7 @@ import java.io.InputStream;
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;
@@ -36,6 +37,7 @@ import org.apache.commons.logging.LogFactory;
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;
@@ -246,7 +248,11 @@ class PDFRenderingUtil {
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());
diff --git a/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java b/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
index 985974b80..bd4be2a61 100644
--- a/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
+++ b/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
@@ -358,7 +358,10 @@ class PDFStructureTreeBuilder implements StructureTreeEventHandler {
}
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);
@@ -367,7 +370,16 @@ class PDFStructureTreeBuilder implements StructureTreeEventHandler {
}
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) {