Index: Java2DRenderer.java
===================================================================
--- Java2DRenderer.java	(revision 413639)
+++ Java2DRenderer.java	(working copy)
@@ -1,10 +1,11 @@
 /*
- * Copyright 1999-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
  *      http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
@@ -52,6 +53,8 @@
 
 import org.w3c.dom.Document;
 
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.apps.FOUserAgent;
 import org.apache.fop.area.CTM;
@@ -70,6 +73,7 @@
 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.render.AbstractPathOrientedRenderer;
 import org.apache.fop.render.Graphics2DAdapter;
 import org.apache.fop.render.RendererContext;
@@ -102,6 +106,9 @@
  */
 public abstract class Java2DRenderer extends AbstractPathOrientedRenderer implements Printable {
 
+    /** Rendering Options key for the controlling the transparent page background option. */
+    public static final String JAVA2D_TRANSPARENT_PAGE_BACKGROUND = "transparent-page-background";
+
     /** The scale factor for the image size, values: ]0 ; 1] */
     protected double scaleFactor = 1;
 
@@ -126,6 +133,9 @@
     /** true if qualityRendering is set */
     protected boolean qualityRendering = true;
 
+    /** false: paints a non-transparent white background, true: for a transparent background */
+    protected boolean transparentPageBackground = false;
+    
     /** The current state, holds a Graphics2D and its context */
     protected Java2DGraphicsState state;
     
@@ -141,11 +151,29 @@
     }
 
     /**
+     * @see org.apache.fop.render.AbstractRenderer#configure(
+     *          org.apache.avalon.framework.configuration.Configuration)
+     */
+    public void configure(Configuration cfg) throws ConfigurationException {
+        super.configure(cfg);
+
+        String s = cfg.getChild(JAVA2D_TRANSPARENT_PAGE_BACKGROUND, true).getValue(null);
+        if (s != null) {
+            this.transparentPageBackground = "true".equalsIgnoreCase(s);
+        }
+    }
+
+    /**
      * @see org.apache.fop.render.Renderer#setUserAgent(org.apache.fop.apps.FOUserAgent)
      */
     public void setUserAgent(FOUserAgent foUserAgent) {
         super.setUserAgent(foUserAgent);
         userAgent.setRendererOverride(this); // for document regeneration
+        
+        String s = (String)userAgent.getRendererOptions().get(JAVA2D_TRANSPARENT_PAGE_BACKGROUND);
+        if (s != null) {
+            this.transparentPageBackground = "true".equalsIgnoreCase(s);
+        }
     }
 
     /** @return the FOUserAgent */
@@ -286,9 +314,7 @@
             int bitmapHeight = (int) ((pageHeight * scaleY) + 0.5);
                     
             
-            BufferedImage currentPageImage = new BufferedImage(
-                    bitmapWidth, bitmapHeight, BufferedImage.TYPE_INT_ARGB);
-            // FIXME TYPE_BYTE_BINARY ?
+            BufferedImage currentPageImage = getBufferedImage(bitmapWidth, bitmapHeight);
 
             Graphics2D graphics = currentPageImage.createGraphics();
             graphics.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
@@ -310,8 +336,10 @@
             graphics.setTransform(at);
 
             // draw page frame
-            graphics.setColor(Color.white);
-            graphics.fillRect(0, 0, pageWidth, pageHeight);
+            if (!transparentPageBackground) {
+                graphics.setColor(Color.white);
+                graphics.fillRect(0, 0, pageWidth, pageHeight);
+            }
             graphics.setColor(Color.black);
             graphics.drawRect(-1, -1, pageWidth + 2, pageHeight + 2);
             graphics.drawLine(pageWidth + 2, 0, pageWidth + 2, pageHeight + 2);
@@ -337,8 +365,23 @@
         }
     }
 
-        
     /**
+     * Returns a specific <coede>BufferedImage</code> depending on this <code>Java2DRenderer</code>
+     * implementation configuration.
+     * <p>
+     * Override this method to obtain new 
+     *
+     * @param bitmapWidth
+     * @param bitmapHeight
+     * @return
+     */
+    protected BufferedImage getBufferedImage(int bitmapWidth, int bitmapHeight)
+    {
+    	return new BufferedImage(
+                bitmapWidth, bitmapHeight, BufferedImage.TYPE_INT_ARGB);
+    }
+
+	/**
      * Returns a page viewport.
      * @param pageNum the page number
      * @return the requested PageViewport instance
