aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/pdf
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2006-02-17 16:18:04 +0000
committerJeremias Maerki <jeremias@apache.org>2006-02-17 16:18:04 +0000
commitbb601dc8aa70faa53cdfac917161f7d2ef7fc1a3 (patch)
tree7ed71ff48b867f840939cb4f9a8dbe2eda5bb89e /src/java/org/apache/fop/render/pdf
parent7d3e991871bb74e8e2ce7eb77f2e5748e7d84d63 (diff)
downloadxmlgraphics-fop-bb601dc8aa70faa53cdfac917161f7d2ef7fc1a3.tar.gz
xmlgraphics-fop-bb601dc8aa70faa53cdfac917161f7d2ef7fc1a3.zip
XMP metadata generation from the PDFInfo object now conforms to PDF/A-1 (6.7.3 in ISO 19005-1:2005(E)).
On PDFDocument, it is now possible to set the PDF-A mode which triggers conformance checks where necessary. The first PDF/A-1b conformance checks are now in the code. When conformance problems are detected, the new PDFConformanceException (subclass of RuntimeException since this would be a programmer error) is thrown. PDF Renderer got a setting (through rendering options and XML configuration) to set the PDF/A-1 mode. Default is "disabled". git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@378560 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/pdf')
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFRenderer.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
index d0f65d16f..33602792d 100644
--- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
@@ -62,6 +62,7 @@ import org.apache.fop.fonts.FontSetup;
import org.apache.fop.image.FopImage;
import org.apache.fop.image.ImageFactory;
import org.apache.fop.image.XMLImage;
+import org.apache.fop.pdf.PDFAMode;
import org.apache.fop.pdf.PDFAnnotList;
import org.apache.fop.pdf.PDFColor;
import org.apache.fop.pdf.PDFDocument;
@@ -109,6 +110,9 @@ public class PDFRenderer extends AbstractPathOrientedRenderer {
*/
public static final String MIME_TYPE = MimeConstants.MIME_PDF;
+ /** Rendering Options key for the PDF/A mode. */
+ public static final String PDF_A_MODE = "pdf-a-mode";
+
/** Controls whether comments are written to the PDF stream. */
protected static final boolean WRITE_COMMENTS = true;
@@ -117,6 +121,9 @@ public class PDFRenderer extends AbstractPathOrientedRenderer {
*/
protected PDFDocument pdfDoc;
+ /** the PDF/A mode (Default: disabled) */
+ protected PDFAMode pdfAMode = PDFAMode.DISABLED;
+
/**
* Map of pages using the PageViewport as the key
* this is used for prepared pages that cannot be immediately
@@ -230,6 +237,11 @@ public class PDFRenderer extends AbstractPathOrientedRenderer {
} else {
this.fontList.addAll(cfgFonts);
}
+
+ String s = cfg.getChild(PDF_A_MODE, true).getValue(null);
+ if (s != null) {
+ this.pdfAMode = PDFAMode.valueOf(s);
+ }
}
/**
@@ -237,6 +249,10 @@ public class PDFRenderer extends AbstractPathOrientedRenderer {
*/
public void setUserAgent(FOUserAgent agent) {
super.setUserAgent(agent);
+ String s = (String)agent.getRendererOptions().get(PDF_A_MODE);
+ if (s != null) {
+ this.pdfAMode = PDFAMode.valueOf(s);
+ }
}
/**
@@ -249,6 +265,7 @@ public class PDFRenderer extends AbstractPathOrientedRenderer {
ostream = stream;
this.pdfDoc = new PDFDocument(
userAgent.getProducer() != null ? userAgent.getProducer() : "");
+ this.pdfDoc.setPDFAMode(this.pdfAMode);
this.pdfDoc.setCreator(userAgent.getCreator());
this.pdfDoc.setCreationDate(userAgent.getCreationDate());
this.pdfDoc.getInfo().setAuthor(userAgent.getAuthor());