diff options
-rw-r--r-- | src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java | 18 | ||||
-rw-r--r-- | src/java/org/apache/fop/svg/PDFTranscoder.java | 14 |
2 files changed, 24 insertions, 8 deletions
diff --git a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java index e228b16bc..e6a855b83 100644 --- a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java +++ b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java @@ -21,7 +21,12 @@ package org.apache.fop.render.ps; import java.awt.Color; +import java.io.BufferedOutputStream; import java.io.IOException; +import java.io.OutputStream; + +import org.w3c.dom.Document; +import org.w3c.dom.svg.SVGLength; import org.apache.avalon.framework.configuration.Configuration; import org.apache.batik.bridge.BridgeContext; @@ -29,13 +34,12 @@ import org.apache.batik.bridge.UnitProcessor; import org.apache.batik.transcoder.TranscoderException; import org.apache.batik.transcoder.TranscoderOutput; import org.apache.batik.transcoder.image.ImageTranscoder; +import org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D; +import org.apache.xmlgraphics.java2d.ps.TextHandler; + import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontSetup; import org.apache.fop.svg.AbstractFOPTranscoder; -import org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D; -import org.apache.xmlgraphics.java2d.ps.TextHandler; -import org.w3c.dom.Document; -import org.w3c.dom.svg.SVGLength; /** * This class enables to transcode an input to a PostScript document. @@ -114,7 +118,11 @@ public abstract class AbstractPSTranscoder extends AbstractFOPTranscoder { getLogger().trace("document size: " + w + "pt x " + h + "pt"); try { - graphics.setupDocument(output.getOutputStream(), w, h); + OutputStream out = output.getOutputStream(); + if (!(out instanceof BufferedOutputStream)) { + out = new BufferedOutputStream(out); + } + graphics.setupDocument(out, w, h); graphics.setViewportDimension(width, height); if (hints.containsKey(ImageTranscoder.KEY_BACKGROUND_COLOR)) { diff --git a/src/java/org/apache/fop/svg/PDFTranscoder.java b/src/java/org/apache/fop/svg/PDFTranscoder.java index f0d40b574..417b82097 100644 --- a/src/java/org/apache/fop/svg/PDFTranscoder.java +++ b/src/java/org/apache/fop/svg/PDFTranscoder.java @@ -20,7 +20,12 @@ package org.apache.fop.svg; import java.awt.Color; +import java.io.BufferedOutputStream; import java.io.IOException; +import java.io.OutputStream; + +import org.w3c.dom.Document; +import org.w3c.dom.svg.SVGLength; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; @@ -36,10 +41,9 @@ import org.apache.batik.transcoder.TranscodingHints; import org.apache.batik.transcoder.image.ImageTranscoder; import org.apache.batik.transcoder.keys.BooleanKey; import org.apache.batik.transcoder.keys.FloatKey; + import org.apache.fop.Version; import org.apache.fop.fonts.FontInfo; -import org.w3c.dom.Document; -import org.w3c.dom.svg.SVGLength; /** * This class enables to transcode an input to a pdf document. @@ -195,7 +199,11 @@ public class PDFTranscoder extends AbstractFOPTranscoder if (hints.containsKey(KEY_DEVICE_RESOLUTION)) { graphics.setDeviceDPI(((Float)hints.get(KEY_DEVICE_RESOLUTION)).floatValue()); } - graphics.setupDocument(output.getOutputStream(), w, h); + OutputStream out = output.getOutputStream(); + if (!(out instanceof BufferedOutputStream)) { + out = new BufferedOutputStream(out); + } + graphics.setupDocument(out, w, h); graphics.setSVGDimension(width, height); if (hints.containsKey(ImageTranscoder.KEY_BACKGROUND_COLOR)) { |