aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2006-03-23 09:52:24 +0000
committerJeremias Maerki <jeremias@apache.org>2006-03-23 09:52:24 +0000
commitfe6d70ed570bc56cc1efce095231ddcfc0d65c92 (patch)
tree59555ef853b151f35cf96d21026743d550d8fedc /src
parent53ca2fb678c5088193c97c5d5fb835ec88796a8d (diff)
downloadxmlgraphics-fop-fe6d70ed570bc56cc1efce095231ddcfc0d65c92.tar.gz
xmlgraphics-fop-fe6d70ed570bc56cc1efce095231ddcfc0d65c92.zip
The about attribute must have the "rdf" namespace prefix.
Adobe Acrobat uses an outdated namespace URI for the PDF/A identification, so do the same as Adobe Distiller: write the PDF/A identification twice, once with each namespace URI. Reason: Acrobat is probably the best tool to verify PDF/A conformance right now. jHove covers only part of ISO 19005-1. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@388126 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/fo/extensions/xmp/XMPConstants.java6
-rw-r--r--src/java/org/apache/fop/pdf/PDFMetadata.java56
2 files changed, 40 insertions, 22 deletions
diff --git a/src/java/org/apache/fop/fo/extensions/xmp/XMPConstants.java b/src/java/org/apache/fop/fo/extensions/xmp/XMPConstants.java
index 6edb1fa41..6c4c33fb3 100644
--- a/src/java/org/apache/fop/fo/extensions/xmp/XMPConstants.java
+++ b/src/java/org/apache/fop/fo/extensions/xmp/XMPConstants.java
@@ -41,4 +41,10 @@ public interface XMPConstants {
/** Namespace URI for the PDF/A Identification Schema */
String PDF_A_IDENTIFICATION = "http://www.aiim.org/pdfa/ns/id";
+ /**
+ * Namespace URI for the PDF/A Identification Schema
+ * (from an older draft of ISO 19005-1, used by Adobe Acrobat)
+ */
+ String PDF_A_IDENTIFICATION_OLD = "http://www.aiim.org/pdfa/ns/id.html";
+
}
diff --git a/src/java/org/apache/fop/pdf/PDFMetadata.java b/src/java/org/apache/fop/pdf/PDFMetadata.java
index 6aec41ca5..13774c026 100644
--- a/src/java/org/apache/fop/pdf/PDFMetadata.java
+++ b/src/java/org/apache/fop/pdf/PDFMetadata.java
@@ -45,6 +45,8 @@ import org.w3c.dom.Element;
*/
public class PDFMetadata extends PDFStream {
+ private static final String XMLNS = "http://www.w3.org/2000/xmlns/";
+
private Document xmpMetadata;
private boolean readOnly = true;
@@ -167,12 +169,10 @@ public class PDFMetadata extends PDFStream {
info.setCreationDate(d);
}
- final String xmlns = "http://www.w3.org/2000/xmlns/";
-
//Dublin Core
desc = doc.createElementNS(XMPConstants.RDF_NAMESPACE, "rdf:Description");
- desc.setAttribute("about", "");
- desc.setAttributeNS(xmlns, "xmlns:dc", XMPConstants.DUBLIN_CORE_NAMESPACE);
+ desc.setAttributeNS(XMPConstants.RDF_NAMESPACE, "rdf:about", "");
+ desc.setAttributeNS(XMLNS, "xmlns:dc", XMPConstants.DUBLIN_CORE_NAMESPACE);
rdf.appendChild(desc);
if (info.getAuthor() != null) {
el = doc.createElementNS(XMPConstants.DUBLIN_CORE_NAMESPACE, "dc:creator");
@@ -199,8 +199,8 @@ public class PDFMetadata extends PDFStream {
//XMP Basic Schema
desc = doc.createElementNS(XMPConstants.RDF_NAMESPACE, "rdf:Description");
- desc.setAttribute("about", "");
- desc.setAttributeNS(xmlns, "xmlns:xmp", XMPConstants.XMP_BASIC_NAMESPACE);
+ desc.setAttributeNS(XMPConstants.RDF_NAMESPACE, "rdf:about", "");
+ desc.setAttributeNS(XMLNS, "xmlns:xmp", XMPConstants.XMP_BASIC_NAMESPACE);
rdf.appendChild(desc);
el = doc.createElementNS(XMPConstants.XMP_BASIC_NAMESPACE, "xmp:createDate");
desc.appendChild(el);
@@ -213,8 +213,8 @@ public class PDFMetadata extends PDFStream {
//Adobe PDF Schema
desc = doc.createElementNS(XMPConstants.RDF_NAMESPACE, "rdf:Description");
- desc.setAttribute("about", "");
- desc.setAttributeNS(xmlns, "xmlns:pdf", XMPConstants.ADOBE_PDF_NAMESPACE);
+ desc.setAttributeNS(XMPConstants.RDF_NAMESPACE, "rdf:about", "");
+ desc.setAttributeNS(XMLNS, "xmlns:pdf", XMPConstants.ADOBE_PDF_NAMESPACE);
rdf.appendChild(desc);
if (info.getKeywords() != null) {
el = doc.createElementNS(XMPConstants.ADOBE_PDF_NAMESPACE, "pdf:Keywords");
@@ -233,24 +233,36 @@ public class PDFMetadata extends PDFStream {
//PDF/A identification
PDFAMode pdfaMode = pdfDoc.getPDFAMode();
if (pdfaMode.isPDFA1LevelB()) {
- desc = doc.createElementNS(XMPConstants.RDF_NAMESPACE, "rdf:Description");
- desc.setAttribute("about", "");
- desc.setAttributeNS(xmlns, "xmlns:pdfaid", XMPConstants.PDF_A_IDENTIFICATION);
- rdf.appendChild(desc);
- el = doc.createElementNS(XMPConstants.PDF_A_IDENTIFICATION, "pdfaid:part");
- desc.appendChild(el);
- el.appendChild(doc.createTextNode("1")); //PDF/A-1
- el = doc.createElementNS(XMPConstants.PDF_A_IDENTIFICATION, "pdfaid:conformance");
- desc.appendChild(el);
- if (pdfaMode == PDFAMode.PDFA_1A) {
- el.appendChild(doc.createTextNode("A")); //PDF/A-1a
- } else {
- el.appendChild(doc.createTextNode("B")); //PDF/A-1b
- }
+ createPDFAIndentification(doc, rdf,
+ XMPConstants.PDF_A_IDENTIFICATION, "pdfaid", pdfaMode);
+ //Create the identification a second time with the old namespace to keep
+ //Adobe Acrobat happy
+ createPDFAIndentification(doc, rdf,
+ XMPConstants.PDF_A_IDENTIFICATION_OLD, "pdfaid_1", pdfaMode);
}
return doc;
}
+
+ private static void createPDFAIndentification(Document doc, Element rdf,
+ String pdfaNamespace, String prefix, PDFAMode pdfaMode) {
+ Element desc;
+ Element el;
+ desc = doc.createElementNS(XMPConstants.RDF_NAMESPACE, "rdf:Description");
+ desc.setAttributeNS(XMPConstants.RDF_NAMESPACE, "rdf:about", "");
+ desc.setAttributeNS(XMLNS, "xmlns:" + prefix, pdfaNamespace);
+ rdf.appendChild(desc);
+ el = doc.createElementNS(pdfaNamespace, prefix + ":part");
+ desc.appendChild(el);
+ el.appendChild(doc.createTextNode("1")); //PDF/A-1
+ el = doc.createElementNS(pdfaNamespace, prefix + ":conformance");
+ desc.appendChild(el);
+ if (pdfaMode == PDFAMode.PDFA_1A) {
+ el.appendChild(doc.createTextNode("A")); //PDF/A-1a
+ } else {
+ el.appendChild(doc.createTextNode("B")); //PDF/A-1b
+ }
+ }
}