1 17 18 19 20 package org.apache.fop.svg; 21 22 import java.awt.geom.AffineTransform ; 23 24 import org.apache.batik.bridge.BridgeContext; 25 import org.apache.batik.bridge.DocumentLoader; 26 import org.apache.batik.bridge.UserAgent; 27 import org.apache.fop.fonts.FontInfo; 28 29 32 public class PDFBridgeContext extends BridgeContext { 33 34 35 private final FontInfo fontInfo; 36 37 private AffineTransform linkTransform; 38 39 48 public PDFBridgeContext(UserAgent userAgent, 49 DocumentLoader loader, 50 FontInfo fontInfo, 51 AffineTransform linkTransform) { 52 super(userAgent, loader); 53 this.fontInfo = fontInfo; 54 this.linkTransform = linkTransform; 55 } 56 57 65 public PDFBridgeContext(UserAgent userAgent, FontInfo fontInfo, 66 AffineTransform linkTransform) { 67 super(userAgent); 68 this.fontInfo = fontInfo; 69 this.linkTransform = linkTransform; 70 } 71 72 78 public PDFBridgeContext(UserAgent userAgent, FontInfo fontInfo) { 79 this(userAgent, fontInfo, null); 80 } 81 82 83 public void registerSVGBridges() { 84 super.registerSVGBridges(); 85 86 if (fontInfo != null) { 87 putBridge(new PDFTextElementBridge(fontInfo)); 88 } 89 90 PDFAElementBridge pdfAElementBridge = new PDFAElementBridge(); 91 if (linkTransform != null) { 92 pdfAElementBridge.setCurrentTransform(linkTransform); 93 } else { 94 pdfAElementBridge.setCurrentTransform(new AffineTransform ()); 95 } 96 putBridge(pdfAElementBridge); 97 98 putBridge(new PDFImageElementBridge()); 99 } 100 101 public BridgeContext createBridgeContext() { 103 return new PDFBridgeContext(getUserAgent(), getDocumentLoader(), 104 fontInfo, linkTransform); 105 } 106 } 107 | Popular Tags |