Author: jeremias
Date: Mon Oct 24 12:44:11 2011
New Revision: 1188123
URL: http://svn.apache.org/viewvc?rev=1188123&view=rev
Log:
Allow to switch to a different page size in mid-document.
Modified:
xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleJava2D2PDF.java
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java
Modified:
xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleJava2D2PDF.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleJava2D2PDF.java?rev=1188123&r1=1188122&r2=1188123&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleJava2D2PDF.java
(original)
+++
xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleJava2D2PDF.java
Mon Oct 24 12:44:11 2011
@@ -116,7 +116,8 @@ public class ExampleJava2D2PDF {
g2d.setFont(new Font("serif", Font.PLAIN, 36));
g2d.drawString("Hello world!", 140, 180);
- g2d.nextPage();
+ pageSize = new Dimension(pageSize.height, pageSize.width);
+ g2d.nextPage(pageSize.width, pageSize.height);
//Demonstrate painting rich text
String someHTML = "<html><body style=\"font-family:Verdana\">"
Modified:
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java?rev=1188123&r1=1188122&r2=1188123&view=diff
==============================================================================
---
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java
(original)
+++
xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java
Mon Oct 24 12:44:11 2011
@@ -113,8 +113,8 @@ public class PDFDocumentGraphics2D exten
* @param textAsShapes set this to true so that text will be rendered
* using curves and not the font.
* @param stream the stream that the final document should be written to.
- * @param width the width of the document
- * @param height the height of the document
+ * @param width the width of the document (in points)
+ * @param height the height of the document (in points)
* @throws IOException an io exception if there is a problem
* writing to the output stream
*/
@@ -253,6 +253,19 @@ public class PDFDocumentGraphics2D exten
}
/**
+ * Is called to prepare the PDFDocumentGraphics2D for the next page to be
painted. Basically,
+ * this closes the current page. A new page is prepared as soon as
painting starts.
+ * This method allows to start the new page (and following pages) with a
different page size.
+ * @param width the width of the new page (in points)
+ * @param height the height of the new page (in points)
+ */
+ public void nextPage(int width, int height) {
+ this.width = width;
+ this.height = height;
+ nextPage();
+ }
+
+ /**
* Closes the current page and adds it to the PDF file.
*/
protected void closePage() {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]