diff options
author | Keiron Liddle <keiron@apache.org> | 2002-11-20 07:51:35 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2002-11-20 07:51:35 +0000 |
commit | c9a1bd7c7ba2e14bd1c8a83bcdf3acea36c9f44e (patch) | |
tree | 0ed339cfcd0dc5c442e40350c2638e6ad233c171 /src/org | |
parent | d8d15aeac70f0065dd3959431ce344d7a5a74fb4 (diff) | |
download | xmlgraphics-fop-c9a1bd7c7ba2e14bd1c8a83bcdf3acea36c9f44e.tar.gz xmlgraphics-fop-c9a1bd7c7ba2e14bd1c8a83bcdf3acea36c9f44e.zip |
enable setting creator
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195570 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/apache/fop/pdf/PDFDocument.java | 9 | ||||
-rw-r--r-- | src/org/apache/fop/pdf/PDFInfo.java | 13 | ||||
-rw-r--r-- | src/org/apache/fop/render/AbstractRenderer.java | 7 | ||||
-rw-r--r-- | src/org/apache/fop/render/Renderer.java | 14 | ||||
-rw-r--r-- | src/org/apache/fop/render/pdf/PDFRenderer.java | 18 |
5 files changed, 58 insertions, 3 deletions
diff --git a/src/org/apache/fop/pdf/PDFDocument.java b/src/org/apache/fop/pdf/PDFDocument.java index f4b115770..4c62c85fb 100644 --- a/src/org/apache/fop/pdf/PDFDocument.java +++ b/src/org/apache/fop/pdf/PDFDocument.java @@ -193,6 +193,15 @@ public class PDFDocument { } /** + * set the creator of the document + * + * @param creator string indicating application creating the document + */ + public void setCreator(String creator) { + this.info.setCreator(creator); + } + + /** * Set the filter map to use for filters in this document. * * @param map the map of filter lists for each stream type diff --git a/src/org/apache/fop/pdf/PDFInfo.java b/src/org/apache/fop/pdf/PDFInfo.java index 1004389f9..9193648ab 100644 --- a/src/org/apache/fop/pdf/PDFInfo.java +++ b/src/org/apache/fop/pdf/PDFInfo.java @@ -47,6 +47,15 @@ public class PDFInfo extends PDFObject { this.producer = producer; } + /** + * set the creator string + * + * @param creator the document creator + */ + public void setCreator(String creator) { + this.creator = creator; + } + public void setTitle(String t) { this.title = t; } @@ -84,6 +93,10 @@ public class PDFInfo extends PDFObject { p += "/Keywords (" + this.keywords + ")\n"; } + if (creator != null) { + p += "/Creator (" + this.creator + ")\n"; + } + p += "/Producer (" + this.producer + ")\n"; // creation date in form (D:YYYYMMDDHHmmSSOHH'mm') diff --git a/src/org/apache/fop/render/AbstractRenderer.java b/src/org/apache/fop/render/AbstractRenderer.java index bf489acf6..4c0823b1a 100644 --- a/src/org/apache/fop/render/AbstractRenderer.java +++ b/src/org/apache/fop/render/AbstractRenderer.java @@ -95,6 +95,13 @@ public abstract class AbstractRenderer extends AbstractLogEnabled */ protected int containingIPPosition = 0; + /** @see org.apache.fop.render.Renderer */ + public void setProducer(String producer) { + } + + /** @see org.apache.fop.render.Renderer */ + public void setCreator(String creator) { + } /** @see org.apache.fop.render.Renderer */ public void setUserAgent(FOUserAgent agent) { diff --git a/src/org/apache/fop/render/Renderer.java b/src/org/apache/fop/render/Renderer.java index 9a489c7d7..2fe1a3f0c 100644 --- a/src/org/apache/fop/render/Renderer.java +++ b/src/org/apache/fop/render/Renderer.java @@ -47,6 +47,9 @@ public interface Renderer { /** * Initiates the rendering phase. + * This must only be called once for a rendering. If + * stopRenderer is called then this may be called again + * for a new document rendering. * * @param outputStream The OutputStream to use for output * @exception IOException If an I/O error occurs @@ -56,6 +59,8 @@ public interface Renderer { /** * Signals the end of the rendering phase. + * The renderer should reset to an initial state and dispose of + * any resources for the completed rendering. * * @exception IOException If an I/O error occurs */ @@ -93,6 +98,15 @@ public interface Renderer { void setProducer(String producer); /** + * Set the creator of the document to be rendered. If this method + * isn't called the renderer uses a default. + * Note: Not all renderers support this feature. + * + * @param creator The name of the document creator + */ + void setCreator(String creator); + + /** * Reports if out of order rendering is supported. <p> * * Normally, all pages of a document are rendered in their natural order diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java index 609023e1a..16d23e79a 100644 --- a/src/org/apache/fop/render/pdf/PDFRenderer.java +++ b/src/org/apache/fop/render/pdf/PDFRenderer.java @@ -112,7 +112,9 @@ public class PDFRenderer extends PrintRenderer { protected HashMap pageReferences = new HashMap(); protected HashMap pvReferences = new HashMap(); - private String producer; + private String producer = "FOP"; + + private String creator = null; /** * The output stream to write the document to @@ -222,6 +224,15 @@ public class PDFRenderer extends PrintRenderer { } /** + * set the document creator + * + * @param creator string indicating application that is creating the document + */ + public void setCreator(String crea) { + creator = crea; + } + + /** * set the PDF document's producer * * @param producer string indicating application producing PDF @@ -240,8 +251,9 @@ public class PDFRenderer extends PrintRenderer { public void startRenderer(OutputStream stream) throws IOException { ostream = stream; - this.pdfDoc = new PDFDocument(Version.getVersion()); - this.pdfDoc.setProducer(producer); + producer = "FOP " + Version.getVersion(); + this.pdfDoc = new PDFDocument(producer); + this.pdfDoc.setCreator(creator); this.pdfDoc.setFilterMap(filterMap); pdfDoc.outputHeader(stream); } |