[FOray-commit] SF.net SVN: foray: [9331] trunk/foray
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2007-05-02 23:44:08
|
Revision: 9331
http://svn.sourceforge.net/foray/?rev=9331&view=rev
Author: victormote
Date: 2007-05-02 16:44:09 -0700 (Wed, 02 May 2007)
Log Message:
-----------
1. Conform to axsl changes for new methods for setting document metadata in PDFs.
2. Implement the area tree methods for retrieving the document metadata from the FO tree.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java
trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java
trunk/foray/foray-render/src/java/org/foray/render/Renderer.java
trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2007-05-02 23:23:58 UTC (rev 9330)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AreaTree.java 2007-05-02 23:44:09 UTC (rev 9331)
@@ -413,32 +413,28 @@
* {@inheritDoc}
*/
public String getTitle() {
- /* Implement this. */
- return null;
+ return this.getRoot().getTitle();
}
/**
* {@inheritDoc}
*/
public String getAuthor() {
- /* Implement this. */
- return null;
+ return this.getRoot().getAuthor();
}
/**
* {@inheritDoc}
*/
public String getSubject() {
- /* Implement this. */
- return null;
+ return this.getRoot().getSubject();
}
/**
* {@inheritDoc}
*/
public String getKeywords() {
- /* Implement this. */
- return null;
+ return this.getRoot().getKeywords();
}
}
Modified: trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java
===================================================================
--- trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2007-05-02 23:23:58 UTC (rev 9330)
+++ trunk/foray/foray-pdf/src/java/org/foray/pdf/object/PDFDocument.java 2007-05-02 23:44:09 UTC (rev 9331)
@@ -649,6 +649,38 @@
}
/**
+ * Sets the title of the document.
+ * @param title The new title for the document.
+ */
+ public void setTitle(final String title) {
+ this.getInfo().setTitle(title);
+ }
+
+ /**
+ * Sets the author of the document.
+ * @param author The new author of the document.
+ */
+ public void setAuthor(final String author) {
+ this.getInfo().setAuthor(author);
+ }
+
+ /**
+ * Sets the subject of the document.
+ * @param subject The new subject of the document.
+ */
+ public void setSubject(final String subject) {
+ this.getInfo().setSubject(subject);
+ }
+
+ /**
+ * Sets the keywords of the document.
+ * @param keywords The new keywords of the document.
+ */
+ public void setKeywords(final String keywords) {
+ this.getInfo().setKeywords(keywords);
+ }
+
+ /**
* {@inheritDoc}
*/
public void setProducer(final String producer) {
Modified: trunk/foray/foray-render/src/java/org/foray/render/Renderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/Renderer.java 2007-05-02 23:23:58 UTC (rev 9330)
+++ trunk/foray/foray-render/src/java/org/foray/render/Renderer.java 2007-05-02 23:44:09 UTC (rev 9331)
@@ -678,4 +678,12 @@
* WKConstants.PERCENT_CONVERSION);
}
+ /**
+ * Returns the area tree being rendered.
+ * @return The area tree being rendered.
+ */
+ protected AreaTree getAreaTree() {
+ return this.areaTree;
+ }
+
}
Modified: trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java
===================================================================
--- trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2007-05-02 23:23:58 UTC (rev 9330)
+++ trunk/foray/foray-render/src/java/org/foray/render/pdf/PDFRenderer.java 2007-05-02 23:44:09 UTC (rev 9331)
@@ -40,6 +40,7 @@
import org.axsl.areaR.Area;
import org.axsl.areaR.AreaNode;
import org.axsl.areaR.AreaRException;
+import org.axsl.areaR.AreaTree;
import org.axsl.areaR.BookmarkArea;
import org.axsl.areaR.BookmarkTitleArea;
import org.axsl.areaR.BookmarkTreeArea;
@@ -181,6 +182,7 @@
* PageCollection.
*/
renderDocumentNodes();
+ renderDocumentMetadata();
pdfDoc.close();
// this frees up memory and makes the renderer reusable
@@ -536,4 +538,15 @@
return this.currentPage.getContentStream();
}
+ /**
+ * Add the document metadata to the PDF.
+ */
+ private void renderDocumentMetadata() {
+ final AreaTree areaTree = this.getAreaTree();
+ this.pdfDoc.setTitle(areaTree.getTitle());
+ this.pdfDoc.setAuthor(areaTree.getAuthor());
+ this.pdfDoc.setSubject(areaTree.getSubject());
+ this.pdfDoc.setKeywords(areaTree.getKeywords());
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|