jeremias 2005/02/12 07:33:08
Modified: src/java/org/apache/fop/pdf PDFInfo.java
src/java/org/apache/fop/apps FOUserAgent.java
src/java/org/apache/fop/render/pdf PDFRenderer.java
Log:
Extend the user agent to pipe title, author and keywords through to the PDF.
A title on the user agent will override any title info gathered from fo:title
elements.
Revision Changes Path
1.7 +6 -1 xml-fop/src/java/org/apache/fop/pdf/PDFInfo.java
Index: PDFInfo.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/pdf/PDFInfo.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PDFInfo.java 3 Apr 2004 08:30:08 -0000 1.6
+++ PDFInfo.java 12 Feb 2005 15:33:07 -0000 1.7
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -62,6 +62,11 @@
this.creator = creator;
}
+ /** @return the title string */
+ public String getTitle() {
+ return this.title;
+ }
+
/**
* set the title string
*
1.21 +58 -2 xml-fop/src/java/org/apache/fop/apps/FOUserAgent.java
Index: FOUserAgent.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/apps/FOUserAgent.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- FOUserAgent.java 24 Dec 2004 12:06:25 -0000 1.20
+++ FOUserAgent.java 12 Feb 2005 15:33:07 -0000 1.21
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -98,6 +98,13 @@
*/
protected Date creationDate = null;
+ /** Author of the content of the document. */
+ protected String author = null;
+ /** Title of the document. */
+ protected String title = null;
+ /** Set of keywords applicable to this document. */
+ protected String keywords = null;
+
/**
* Sets the InputHandler object for this process
* @param inputHandler holding input file name information
@@ -234,6 +241,55 @@
}
/**
+ * Sets the author of the document.
+ * @param author of document
+ */
+ public void setAuthor(String author) {
+ this.author = author;
+ }
+
+ /**
+ * Returns the author of the document
+ * @return author name
+ */
+ public String getAuthor() {
+ return author;
+ }
+
+ /**
+ * Sets the title of the document. This will override any title coming
from
+ * an fo:title element.
+ * @param title of document
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * Returns the title of the document
+ * @return title name
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * Sets the keywords for the document.
+ * @param keywords for the document
+ */
+ public void setKeywords(String keywords) {
+ this.keywords = keywords;
+ }
+
+ /**
+ * Returns the keywords for the document
+ * @return the keywords
+ */
+ public String getKeywords() {
+ return keywords;
+ }
+
+ /**
* Returns the renderer options
* @return renderer options
*/
1.80 +6 -2
xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java
Index: PDFRenderer.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/render/pdf/PDFRenderer.java,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -r1.79 -r1.80
--- PDFRenderer.java 11 Feb 2005 21:30:03 -0000 1.79
+++ PDFRenderer.java 12 Feb 2005 15:33:08 -0000 1.80
@@ -84,7 +84,6 @@
import org.apache.fop.render.RendererContext;
import org.apache.fop.traits.BorderProps;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.properties.ColorTypeProperty;
/*
@@ -253,6 +252,9 @@
userAgent.getProducer() != null ? userAgent.getProducer() :
"");
this.pdfDoc.setCreator(userAgent.getCreator());
this.pdfDoc.setCreationDate(userAgent.getCreationDate());
+ this.pdfDoc.getInfo().setAuthor(userAgent.getAuthor());
+ this.pdfDoc.getInfo().setTitle(userAgent.getTitle());
+ this.pdfDoc.getInfo().setKeywords(userAgent.getKeywords());
this.pdfDoc.setFilterMap(filterMap);
this.pdfDoc.outputHeader(stream);
@@ -390,7 +392,9 @@
if (seqTitle != null) {
String str = convertTitleToString(seqTitle);
PDFInfo info = this.pdfDoc.getInfo();
- info.setTitle(str);
+ if (info.getTitle() == null) {
+ info.setTitle(str);
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]