aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/svg/PDFTranscoder.java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2005-11-09 15:42:51 +0000
committerJeremias Maerki <jeremias@apache.org>2005-11-09 15:42:51 +0000
commit8edc1d2224e937c065b8d635f1760b62e783d8dd (patch)
tree8a99bd57ea9b4511919f27423109b9f3f2281e32 /src/java/org/apache/fop/svg/PDFTranscoder.java
parent20fa5268df0017236762f1bcf2ebbcad1e623ac5 (diff)
downloadxmlgraphics-fop-8edc1d2224e937c065b8d635f1760b62e783d8dd.tar.gz
xmlgraphics-fop-8edc1d2224e937c065b8d635f1760b62e783d8dd.zip
Bugzilla #37330:
Fix for bridge registration. Submitted by: Thomas Deweese <deweese.at.apache.org> git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@332070 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/svg/PDFTranscoder.java')
-rw-r--r--src/java/org/apache/fop/svg/PDFTranscoder.java74
1 files changed, 47 insertions, 27 deletions
diff --git a/src/java/org/apache/fop/svg/PDFTranscoder.java b/src/java/org/apache/fop/svg/PDFTranscoder.java
index dba8f84c5..d19f75bcf 100644
--- a/src/java/org/apache/fop/svg/PDFTranscoder.java
+++ b/src/java/org/apache/fop/svg/PDFTranscoder.java
@@ -30,8 +30,6 @@ import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.bridge.UnitProcessor;
import org.apache.batik.bridge.UserAgent;
import org.apache.batik.ext.awt.RenderingHintsKeyExt;
-import org.apache.batik.gvt.TextPainter;
-import org.apache.batik.gvt.renderer.StrokingTextPainter;
import org.apache.batik.transcoder.TranscoderException;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.image.ImageTranscoder;
@@ -69,6 +67,8 @@ public class PDFTranscoder extends AbstractFOPTranscoder
implements Configurable {
private Configuration cfg = null;
+
+ /** Graphics2D instance that is used to paint to */
protected PDFDocumentGraphics2D graphics = null;
/**
@@ -149,10 +149,12 @@ public class PDFTranscoder extends AbstractFOPTranscoder
if (hints.containsKey(ImageTranscoder.KEY_BACKGROUND_COLOR)) {
graphics.setBackgroundColor
((Color)hints.get(ImageTranscoder.KEY_BACKGROUND_COLOR));
- }
+ }
graphics.setGraphicContext
(new org.apache.batik.ext.awt.g2d.GraphicContext());
- graphics.setTransform(curTxf);
+ graphics.preparePainting();
+
+ graphics.transform(curTxf);
graphics.setRenderingHint
(RenderingHintsKeyExt.KEY_TRANSCODING,
RenderingHintsKeyExt.VALUE_TRANSCODING_VECTOR);
@@ -165,31 +167,49 @@ public class PDFTranscoder extends AbstractFOPTranscoder
}
}
+ /** @see org.apache.batik.transcoder.SVGAbstractTranscoder#createBridgeContext() */
protected BridgeContext createBridgeContext() {
- /*boolean stroke = true;
- if (hints.containsKey(KEY_STROKE_TEXT)) {
- stroke = ((Boolean)hints.get(KEY_STROKE_TEXT)).booleanValue();
- }*/
-
- BridgeContext ctx = new BridgeContext(userAgent);
- TextPainter textPainter = null;
- textPainter = new StrokingTextPainter();
- ctx.setTextPainter(textPainter);
- /*if (!stroke) {
- textPainter = new PDFTextPainter(graphics.getFontInfo());
- ctx.setTextPainter(textPainter);
- }*/
-
- PDFTextElementBridge pdfTextElementBridge;
- pdfTextElementBridge = new PDFTextElementBridge(graphics.getFontInfo());
- ctx.putBridge(pdfTextElementBridge);
-
- PDFAElementBridge pdfAElementBridge = new PDFAElementBridge();
- AffineTransform currentTransform = new AffineTransform(1, 0, 0, 1, 0, 0);
- pdfAElementBridge.setCurrentTransform(currentTransform);
- ctx.putBridge(pdfAElementBridge);
- ctx.putBridge(new PDFImageElementBridge());
+ BridgeContext ctx = new PDFBridgeContext(userAgent);
+
return ctx;
}
+ /**
+ * BridgeContext which registers the custom bridges for PDF output.
+ */
+ public class PDFBridgeContext extends BridgeContext {
+ /**
+ * Constructs a new bridge context.
+ * @param userAgent the user agent
+ */
+ public PDFBridgeContext(UserAgent userAgent) {
+ super(userAgent);
+ }
+
+ /** @see org.apache.batik.bridge.BridgeContext#registerSVGBridges() */
+ public void registerSVGBridges() {
+ super.registerSVGBridges();
+
+ /*
+ boolean stroke = true;
+ if (hints.containsKey(KEY_STROKE_TEXT)) {
+ stroke = ((Boolean)hints.get(KEY_STROKE_TEXT)).booleanValue();
+ }
+ if (!stroke) {
+ textPainter = new PDFTextPainter(graphics.getFontInfo());
+ ctx.setTextPainter(textPainter);
+ }
+ */
+
+ putBridge(new PDFTextElementBridge(graphics.getFontInfo()));
+
+ PDFAElementBridge pdfAElementBridge = new PDFAElementBridge();
+ pdfAElementBridge.setCurrentTransform(new AffineTransform());
+ putBridge(pdfAElementBridge);
+
+ putBridge(new PDFImageElementBridge());
+ }
+
+ }
+
}