Source code: com/mvsteenb/javauitransformer/printtransformer/svgtransformer/SVGTransformer.java
1 package com.mvsteenb.javauitransformer.printtransformer.svgtransformer;
2
3 import com.mvsteenb.fop.apps.Driver;
4 //import org.apache.fop.apps.Driver;
5 import org.xml.sax.InputSource;
6
7 import javax.xml.transform.TransformerException;
8 import java.io.InputStream;
9 import java.io.OutputStream;
10
11 /**
12 * com.mvsteenb.javauitransformer.printtransformer.svgtransformer
13 *
14 * <p><b>About</b></p>
15 *
16 * <p>
17 * This class is part of the JavaUIFormatter version @build.version@ (build #@build.number@) which was built on @build.date@.
18 * </p>
19 *
20 * <p><b>Description</b></p>
21 *
22 *
23 * <p><b>Free Software</b></p>
24 *
25 * <p>
26 * Copyright (C) 2003 Mario Van Steenberghe
27 * </p>
28 *
29 * <p>
30 * <small>
31 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser
32 * General Public License as published by the Free Software Foundation; either version 2.1 of the License, or
33 * (at your option) any later version. This library is distributed in the hope that it will be useful,
34 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
35 * PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the
36 * GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc.,
37 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
38 * </small>
39 * </p>
40 *
41 * <p>
42 * <small>
43 * Please contact me at mario.vansteenberghe@pandora.be for more information.
44 * </small>
45 * </p>
46 *
47 *
48 * <p><b>Revision History</b></p>
49 *
50 * <p>
51 * Oct 7, 2003 : mvsteenb : Initial Revision
52 * </p>
53 *
54 */
55
56 public class SVGTransformer {
57
58 /**
59 * Constructor
60 */
61
62 public SVGTransformer() {
63
64 }
65
66 // ================================================================================================================ //
67 // public methods //
68 // ================================================================================================================ //
69
70 /**
71 * Transforms given FO input into SVG format
72 */
73
74 public void transform(InputStream in, OutputStream out) throws TransformerException {
75
76 try {
77 Driver driver = new Driver(new InputSource(in), out);
78 driver.setRenderer(Driver.RENDER_SVG);
79 driver.run();
80 }
81 catch (Exception e) {
82 e.printStackTrace();
83 throw new TransformerException("Could not transform fo input to SVG : " + e.getMessage());
84 }
85
86 }
87 }