Some general checkstyle fixing git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196040 13f79535-47bb-0310-9956-ffa450edef68pull/30/head
@@ -1,9 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render; | |||
// Java | |||
@@ -95,6 +139,12 @@ public abstract class AbstractRenderer extends AbstractLogEnabled | |||
*/ | |||
protected int containingIPPosition = 0; | |||
/** | |||
* @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration) | |||
*/ | |||
public void configure(Configuration conf) throws ConfigurationException { | |||
} | |||
/** @see org.apache.fop.render.Renderer */ | |||
public void setProducer(String producer) { | |||
} | |||
@@ -254,7 +304,7 @@ public abstract class AbstractRenderer extends AbstractLogEnabled | |||
* This should be overridden to draw border and background | |||
* traits for the viewport area. | |||
* | |||
* @param vp the region viewport area | |||
* @param rv the region viewport area | |||
*/ | |||
protected void handleViewportTraits(RegionViewport rv) { | |||
// draw border and background | |||
@@ -369,7 +419,7 @@ public abstract class AbstractRenderer extends AbstractLogEnabled | |||
protected void renderFlow(Flow flow) { | |||
// the normal flow reference area contains stacked blocks | |||
List blocks = flow.getChildAreas(); | |||
if(blocks != null) { | |||
if (blocks != null) { | |||
renderBlocks(blocks); | |||
} | |||
} | |||
@@ -600,7 +650,5 @@ public abstract class AbstractRenderer extends AbstractLogEnabled | |||
} | |||
} | |||
public void configure(Configuration conf) throws ConfigurationException { | |||
} | |||
} | |||
@@ -1,9 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources." | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render; | |||
// FOP | |||
@@ -11,7 +55,7 @@ import org.apache.fop.render.pdf.FontSetup; | |||
import org.apache.fop.layout.FontInfo; | |||
// Java | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
@@ -21,7 +65,8 @@ public abstract class PrintRenderer extends AbstractRenderer { | |||
/** Font configuration */ | |||
protected FontInfo fontInfo; | |||
protected ArrayList fontList = null; | |||
/** list of fonts */ | |||
protected List fontList = null; | |||
/** | |||
* Set up the font info |
@@ -1,9 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render; | |||
// Java |
@@ -1,9 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render; | |||
//Java |
@@ -1,9 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render; | |||
import org.w3c.dom.Document; |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.awt; | |||
// Java |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.awt; | |||
/* | |||
@@ -14,57 +57,38 @@ package org.apache.fop.render.awt; | |||
* Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com | |||
*/ | |||
import org.apache.fop.layout.*; | |||
import org.apache.fop.datatypes.*; | |||
import org.apache.fop.image.*; | |||
import org.apache.fop.svg.*; | |||
import org.apache.fop.render.pdf.*; | |||
import org.apache.fop.viewer.*; | |||
import org.apache.fop.apps.*; | |||
import org.w3c.dom.svg.*; | |||
import org.w3c.dom.Document; | |||
import org.w3c.dom.Element; | |||
import org.apache.batik.bridge.*; | |||
import org.apache.batik.swing.svg.*; | |||
import org.apache.batik.swing.gvt.*; | |||
import org.apache.batik.gvt.*; | |||
import org.apache.batik.gvt.renderer.*; | |||
import org.apache.batik.gvt.filter.*; | |||
import org.apache.batik.gvt.event.*; | |||
import java.awt.*; | |||
import java.awt.Image; | |||
import java.awt.image.*; | |||
import java.awt.geom.*; | |||
import java.awt.font.*; | |||
import java.util.*; | |||
import java.net.URL; | |||
import java.net.MalformedURLException; | |||
import java.io.*; | |||
import java.beans.*; | |||
import javax.swing.*; | |||
import java.awt.print.*; | |||
import java.awt.Color; | |||
import java.awt.Component; | |||
import java.awt.Graphics; | |||
import java.awt.Graphics2D; | |||
import java.awt.image.BufferedImage; | |||
import java.text.*; | |||
import java.awt.print.PageFormat; | |||
import java.awt.print.Pageable; | |||
import java.awt.print.Printable; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
import java.util.List; | |||
import java.util.Map; | |||
import org.apache.fop.layout.FontInfo; | |||
import org.apache.fop.render.AbstractRenderer; | |||
import org.apache.fop.viewer.Translator; | |||
/** | |||
*/ | |||
* This is FOP's AWT renderer. | |||
*/ | |||
public class AWTRenderer extends AbstractRenderer implements Printable, Pageable { | |||
protected int pageWidth = 0; | |||
protected int pageHeight = 0; | |||
protected double scaleFactor = 100.0; | |||
protected int pageNumber = 0; | |||
protected Vector pageList = new Vector(); | |||
protected List pageList = new java.util.Vector(); | |||
//protected ProgressListener progressListener = null; | |||
protected Translator res = null; | |||
protected Hashtable fontNames = new Hashtable(); | |||
protected Hashtable fontStyles = new Hashtable(); | |||
protected Map fontNames = new java.util.Hashtable(); | |||
protected Map fontStyles = new java.util.Hashtable(); | |||
protected Color saveColor = null; | |||
/** |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.awt; | |||
// Java |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.awt; | |||
// FOP |
@@ -1,31 +1,61 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.pcl; | |||
// FOP | |||
import org.apache.fop.render.PrintRenderer; | |||
import org.apache.fop.image.FopImage; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.fo.properties.*; | |||
import org.apache.fop.datatypes.*; | |||
import org.apache.fop.pdf.PDFPathPaint; | |||
import org.apache.fop.pdf.PDFColor; | |||
import org.apache.fop.layout.*; | |||
import org.apache.fop.image.*; | |||
import org.w3c.dom.svg.SVGSVGElement; | |||
import org.w3c.dom.svg.SVGDocument; | |||
// Java | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
import java.util.Enumeration; | |||
/** | |||
* Renderer that renders areas to PCL | |||
@@ -37,37 +67,37 @@ public class PCLRenderer extends PrintRenderer { | |||
/** | |||
* the current stream to add PCL commands to | |||
*/ | |||
public PCLStream currentStream; | |||
protected PCLStream currentStream; | |||
private int pageHeight = 7920; | |||
// These variables control the virtual paggination functionality. | |||
public int curdiv = 0; | |||
private int curdiv = 0; | |||
private int divisions = -1; | |||
public int paperheight = -1; // Paper height in decipoints? | |||
public int orientation = | |||
-1; // -1=default/unknown, 0=portrait, 1=landscape. | |||
public int topmargin = -1; // Top margin in decipoints? | |||
public int leftmargin = -1; // Left margin in decipoints? | |||
private int paperheight = -1; // Paper height in decipoints? | |||
private int orientation = -1; // -1=default/unknown, 0=portrait, 1=landscape. | |||
private int topmargin = -1; // Top margin in decipoints? | |||
private int leftmargin = -1; // Left margin in decipoints? | |||
private int fullmargin = 0; | |||
private final boolean debug = false; | |||
private int xoffset = | |||
-180; // X Offset to allow for PCL implicit 1/4" left margin. | |||
private int xoffset = -180; // X Offset to allow for PCL implicit 1/4" left margin. | |||
private java.util.Hashtable options; | |||
/** | |||
* Create the PCL renderer | |||
*/ | |||
public PCLRenderer() {} | |||
public PCLRenderer() { | |||
} | |||
/** | |||
* set the PCL document's producer | |||
* | |||
* @param producer string indicating application producing PCL | |||
*/ | |||
public void setProducer(String producer) {} | |||
public void setProducer(String producer) { | |||
} | |||
public void setFont(String name, float size) { | |||
int fontcode = 0; | |||
@@ -147,7 +177,8 @@ public class PCLRenderer extends PrintRenderer { | |||
currentStream.add("\033(19M\033(s1p" + (size / 1000) | |||
+ "v0s0b16686T"); | |||
// currentStream.add("\033(9U\033(s1p" + (size / 1000) + "v0s0b25093T"); // ECMA Latin 1 Symbol Set in Times Roman??? | |||
// ECMA Latin 1 Symbol Set in Times Roman??? | |||
// currentStream.add("\033(9U\033(s1p" + (size / 1000) + "v0s0b25093T"); | |||
break; | |||
case 14: // F14 = Zapf Dingbats | |||
@@ -160,27 +191,27 @@ public class PCLRenderer extends PrintRenderer { | |||
} | |||
} | |||
public void startRenderer(OutputStream outputStream) | |||
throws IOException { | |||
public void startRenderer(OutputStream outputStream) throws IOException { | |||
getLogger().info("rendering areas to PCL"); | |||
currentStream = new PCLStream(outputStream); | |||
// Set orientation. | |||
if (orientation > -1) | |||
if (orientation > -1) { | |||
currentStream.add("\033&l" + orientation + "O"); | |||
else | |||
} else { | |||
currentStream.add("\033&l0O"); | |||
if (orientation == 1 || orientation == 3) | |||
} | |||
if (orientation == 1 || orientation == 3) { | |||
xoffset = -144; | |||
else | |||
} else { | |||
xoffset = -180; | |||
} | |||
// Reset the margins. | |||
currentStream.add("\033" + "9\033&l0E"); | |||
} | |||
public void stopRenderer() | |||
throws IOException { | |||
public void stopRenderer() throws IOException { | |||
} | |||
} |
@@ -1,31 +1,78 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.pcl; | |||
import java.io.*; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
public class PCLStream { | |||
OutputStream out = null; | |||
boolean doOutput = true; | |||
private OutputStream out = null; | |||
private boolean doOutput = true; | |||
public PCLStream(OutputStream os) { | |||
out = os; | |||
} | |||
public void add(String str) { | |||
if (!doOutput) | |||
if (!doOutput) { | |||
return; | |||
} | |||
byte buff[] = new byte[str.length()]; | |||
int countr; | |||
int len = str.length(); | |||
for (countr = 0; countr < len; countr++) | |||
for (countr = 0; countr < len; countr++) { | |||
buff[countr] = (byte)str.charAt(countr); | |||
} | |||
try { | |||
out.write(buff); | |||
} catch (IOException e) { |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.pdf; | |||
import org.apache.fop.area.CTM; | |||
@@ -24,7 +67,8 @@ public final class CTMHelper { | |||
* <p>Converts the sourceMatrix to a string for use in the PDFRender cm operations.</p> | |||
* <p>For example: | |||
* <pre> | |||
* org.apache.fop.area.CTM ctm = new org.apache.fop.area.CTM(1.0, 0.0, 0.0, 1.0, 1000.0, 1000.0); | |||
* org.apache.fop.area.CTM ctm = | |||
* new org.apache.fop.area.CTM(1.0, 0.0, 0.0, 1.0, 1000.0, 1000.0); | |||
* String pdfMatrix = org.apache.fop.render.pdf.CTMHelper.toPDFString(ctm); | |||
* </pre> | |||
* will return the string "<code>1.0 0.0 0.0 1.0 1.0 1.0</code>". | |||
@@ -32,38 +76,37 @@ public final class CTMHelper { | |||
* @param sourceMatrix - The matrix to convert. | |||
* | |||
* @return a space seperated string containing the matrix elements. | |||
* | |||
* @throws IllegalArgumentException if the sourceMatrix parameter is null. | |||
*/ | |||
public static String toPDFString(CTM sourceMatrix) { | |||
if (null == sourceMatrix) { | |||
throw new IllegalArgumentException("sourceMatrix must not be null"); | |||
throw new NullPointerException("sourceMatrix must not be null"); | |||
} | |||
final double matrix[] = toPDFArray(sourceMatrix); | |||
return matrix[0] + " " + matrix[1] + " " + matrix[2] + " " + | |||
matrix[3] + " " + matrix[4] + " " + matrix[5]; | |||
return matrix[0] + " " + matrix[1] + " " | |||
+ matrix[2] + " " + matrix[3] + " " | |||
+ matrix[4] + " " + matrix[5]; | |||
} | |||
/** | |||
* <p>Creates a new CTM based in the sourceMatrix.</p> | |||
* <p>For example: | |||
* <pre> | |||
* org.apache.fop.area.CTM inCTM = new org.apache.fop.area.CTM(1.0, 0.0, 0.0, 1.0, 1000.0, 1000.0); | |||
* org.apache.fop.area.CTM outCTM org.apache.fop.render.pdf.CTMHelper.toPDFCTM(ctm); | |||
* org.apache.fop.area.CTM inCTM = | |||
* new org.apache.fop.area.CTM(1.0, 0.0, 0.0, 1.0, 1000.0, 1000.0); | |||
* org.apache.fop.area.CTM outCTM = | |||
* org.apache.fop.render.pdf.CTMHelper.toPDFCTM(ctm); | |||
* </pre> | |||
* will return a new CTM where a == 1.0, b == 0.0, c == 0.0, d == 1.0, e == 1.0 and f == 1.0. | |||
* | |||
* @param sourceMatrix - The matrix to convert. | |||
* | |||
* @return a new converted matrix. | |||
* | |||
* @throws IllegalArgumentException if the sourceMatrix parameter is null. | |||
*/ | |||
public static CTM toPDFCTM(CTM sourceMatrix) { | |||
if (null == sourceMatrix) { | |||
throw new IllegalArgumentException("sourceMatrix must not be null"); | |||
throw new NullPointerException("sourceMatrix must not be null"); | |||
} | |||
final double matrix[] = toPDFArray(sourceMatrix); | |||
@@ -76,21 +119,20 @@ public final class CTMHelper { | |||
* <p>Creates an array of six doubles from the source CTM.</p> | |||
* <p>For example: | |||
* <pre> | |||
* org.apache.fop.area.CTM inCTM = new org.apache.fop.area.CTM(1.0, 0.0, 0.0, 1.0, 1000.0, 1000.0); | |||
* org.apache.fop.area.CTM inCTM = | |||
* new org.apache.fop.area.CTM(1.0, 0.0, 0.0, 1.0, 1000.0, 1000.0); | |||
* double matrix[] = org.apache.fop.render.pdf.CTMHelper.toPDFArray(ctm); | |||
* </pre> | |||
* will return a new array where matrix[0] == 1.0, matrix[1] == 0.0, matrix[2] == 0.0, matrix[3] == 1.0, | |||
* will return a new array where matrix[0] == 1.0, matrix[1] == 0.0, | |||
* matrix[2] == 0.0, matrix[3] == 1.0, | |||
* matrix[4] == 1.0 and matrix[5] == 1.0. | |||
* | |||
* @param sourceMatrix - The matrix to convert. | |||
* | |||
* @return an array of doubles containing the converted matrix. | |||
* | |||
* @throws IllegalArgumentException if the sourceMatrix parameter is null. | |||
*/ | |||
public static double[] toPDFArray(CTM sourceMatrix) { | |||
if (null == sourceMatrix) { | |||
throw new IllegalArgumentException("sourceMatrix must not be null"); | |||
throw new NullPointerException("sourceMatrix must not be null"); | |||
} | |||
final double matrix[] = sourceMatrix.toArray(); |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.pdf; | |||
import java.util.List; |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.pdf; | |||
//Java | |||
@@ -89,6 +132,7 @@ public class FontReader extends DefaultHandler { | |||
/** | |||
* Sets the path to embed a font. A null value disables font embedding. | |||
* @param path URI for the embeddable file | |||
*/ | |||
public void setFontEmbedPath(String path) { | |||
returnFont.setEmbedFileName(path); | |||
@@ -96,6 +140,7 @@ public class FontReader extends DefaultHandler { | |||
/** | |||
* Enable/disable use of kerning for the font | |||
* @param enabled true to enable kerning, false to disable | |||
*/ | |||
public void setKerningEnabled(boolean enabled) { | |||
returnFont.setKerningEnabled(enabled); | |||
@@ -104,6 +149,7 @@ public class FontReader extends DefaultHandler { | |||
/** | |||
* Get the generated font object | |||
* @return the font | |||
*/ | |||
public Font getFont() { | |||
return returnFont; | |||
@@ -112,17 +158,29 @@ public class FontReader extends DefaultHandler { | |||
/** | |||
* Construct a FontReader object from a path to a metric.xml file | |||
* and read metric data | |||
* @param path URI to the font metric file | |||
* @throws FOPException if loading the font fails | |||
*/ | |||
public FontReader(String path) throws FOPException { | |||
createFont(path); | |||
} | |||
public void startDocument() {} | |||
/** | |||
* @see org.xml.sax.ContentHandler#startDocument() | |||
*/ | |||
public void startDocument() { | |||
} | |||
/** | |||
* @see org.xml.sax.ContentHandler#setDocumentLocator(Locator) | |||
*/ | |||
public void setDocumentLocator(Locator locator) { | |||
this.locator = locator; | |||
} | |||
/** | |||
* @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes) | |||
*/ | |||
public void startElement(String uri, String localName, String qName, | |||
Attributes attributes) { | |||
if (localName.equals("font-metrics")) { | |||
@@ -164,7 +222,7 @@ public class FontReader extends DefaultHandler { | |||
//singleFont.width = new int[256]; | |||
} else if ("char".equals(localName)) { | |||
try { | |||
singleFont.setWidth( Integer.parseInt(attributes.getValue("idx")), | |||
singleFont.setWidth(Integer.parseInt(attributes.getValue("idx")), | |||
Integer.parseInt(attributes.getValue("wdt"))); | |||
} catch (NumberFormatException ne) { | |||
System.out.println("Malformed width in metric file: " | |||
@@ -186,6 +244,9 @@ public class FontReader extends DefaultHandler { | |||
return ret; | |||
} | |||
/** | |||
* @see org.xml.sax.ContentHandler#endElement(String, String, String) | |||
*/ | |||
public void endElement(String uri, String localName, String qName) { | |||
if ("font-name".equals(localName)) { | |||
returnFont.setFontName(text.toString()); | |||
@@ -248,6 +309,9 @@ public class FontReader extends DefaultHandler { | |||
text.setLength(0); //Reset text buffer (see characters()) | |||
} | |||
/** | |||
* @see org.xml.sax.ContentHandler#characters(char[], int, int) | |||
*/ | |||
public void characters(char[] ch, int start, int length) { | |||
text.append(ch, start, length); | |||
} |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.pdf; | |||
// FOP |
@@ -1,31 +1,94 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.pdf; | |||
/** | |||
* FontTriplet contains information on name, weight, style of one font | |||
*/ | |||
public class FontTriplet { | |||
private String name, weight, style; | |||
/** | |||
* Creates a new font triplet. | |||
* @param name font name | |||
* @param weight font weight (normal, bold etc.) | |||
* @param style font style (normal, italic etc.) | |||
*/ | |||
public FontTriplet(String name, String weight, String style) { | |||
this.name = name; | |||
this.weight = weight; | |||
this.style = style; | |||
} | |||
/** | |||
* Returns the font name. | |||
* @return the font name | |||
*/ | |||
public String getName() { | |||
return name; | |||
} | |||
/** | |||
* Returns the font weight. | |||
* @return the font weight | |||
*/ | |||
public String getWeight() { | |||
return weight; | |||
} | |||
/** | |||
* Returns the font style. | |||
* @return the font style | |||
*/ | |||
public String getStyle() { | |||
return style; | |||
} |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.pdf; | |||
import org.apache.fop.pdf.PDFImage; | |||
@@ -22,31 +65,45 @@ import org.apache.fop.image.EPSImage; | |||
import java.io.IOException; | |||
import java.awt.color.ColorSpace; | |||
import java.awt.color.ICC_ColorSpace; | |||
import java.awt.color.ICC_Profile; | |||
import java.util.Map; | |||
/** | |||
* PDFImage implementation for the PDF renderer. | |||
*/ | |||
public class FopPDFImage implements PDFImage { | |||
FopImage fopImage; | |||
PDFICCStream pdfICCStream = null; | |||
PDFFilter pdfFilter = null; | |||
String maskRef; | |||
String softMaskRef; | |||
boolean isPS = false; | |||
Map filters; | |||
String key; | |||
public FopPDFImage(FopImage im, String k) { | |||
fopImage = im; | |||
key = k; | |||
private FopImage fopImage; | |||
private PDFICCStream pdfICCStream = null; | |||
private PDFFilter pdfFilter = null; | |||
private String maskRef; | |||
private String softMaskRef; | |||
private boolean isPS = false; | |||
private Map filters; | |||
private String key; | |||
/** | |||
* Creates a new PDFImage from a FopImage | |||
* @param image Image | |||
* @param key XObject key | |||
*/ | |||
public FopPDFImage(FopImage image, String key) { | |||
fopImage = image; | |||
this.key = key; | |||
isPS = (fopImage instanceof EPSImage); | |||
} | |||
// key to look up XObject | |||
/** | |||
* @see org.apache.fop.pdf.PDFImage#getKey() | |||
*/ | |||
public String getKey() { | |||
return key; | |||
// key to look up XObject | |||
return this.key; | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFImage#setup(PDFDocument) | |||
*/ | |||
public void setup(PDFDocument doc) { | |||
filters = doc.getFilterMap(); | |||
if ("image/jpeg".equals(fopImage.getMimeType())) { | |||
@@ -64,47 +121,75 @@ public class FopPDFImage implements PDFImage { | |||
} | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFImage#isPS() | |||
*/ | |||
public boolean isPS() { | |||
return isPS; | |||
} | |||
// image size | |||
/** | |||
* @see org.apache.fop.pdf.PDFImage#getWidth() | |||
*/ | |||
public int getWidth() { | |||
return fopImage.getWidth(); | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFImage#getHeight() | |||
*/ | |||
public int getHeight() { | |||
return fopImage.getHeight(); | |||
} | |||
// DeviceGray, DeviceRGB, or DeviceCMYK | |||
/** | |||
* @see org.apache.fop.pdf.PDFImage#getColorSpace() | |||
*/ | |||
public PDFColorSpace getColorSpace() { | |||
// DeviceGray, DeviceRGB, or DeviceCMYK | |||
return toPDFColorSpace(fopImage.getColorSpace()); | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFImage#getBitsPerPixel() | |||
*/ | |||
public int getBitsPerPixel() { | |||
return fopImage.getBitsPerPixel(); | |||
} | |||
// For transparent images | |||
/** | |||
* @see org.apache.fop.pdf.PDFImage#isTransparent() | |||
*/ | |||
public boolean isTransparent() { | |||
return fopImage.isTransparent(); | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFImage#getTransparentColor() | |||
*/ | |||
public PDFColor getTransparentColor() { | |||
return fopImage.getTransparentColor(); | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFImage#getMask() | |||
*/ | |||
public String getMask() { | |||
return maskRef; | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFImage#getSoftMask() | |||
*/ | |||
public String getSoftMask() { | |||
return softMaskRef; | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFImage#getDataStream() | |||
*/ | |||
public PDFStream getDataStream() throws IOException { | |||
if(isPS) { | |||
if (isPS) { | |||
return getPSDataStream(); | |||
} else { | |||
// delegate the stream work to PDFStream | |||
@@ -125,6 +210,11 @@ public class FopPDFImage implements PDFImage { | |||
} | |||
} | |||
/** | |||
* Returns a PDFStream for an EPS image. | |||
* @return PDFStream the newly creates PDFStream | |||
* @throws IOException in case of an I/O problem | |||
*/ | |||
protected PDFStream getPSDataStream() throws IOException { | |||
int length = 0; | |||
int i = 0; | |||
@@ -146,11 +236,11 @@ public class FopPDFImage implements PDFImage { | |||
preamble.append("/showpage {} def\n"); | |||
preamble.append((double)(1f / (double) bboxw) + " " + | |||
(double)(1f / (double) bboxh) + " scale\n"); | |||
preamble.append((double)(1f / (double) bboxw) + " " | |||
+ (double)(1f / (double) bboxh) + " scale\n"); | |||
preamble.append(-bbox[0] + " " + (-bbox[1]) + " translate\n"); | |||
preamble.append(bbox[0] + " " + bbox[1] + " " + bboxw + " " + | |||
bboxh + " rectclip\n"); | |||
preamble.append(bbox[0] + " " + bbox[1] + " " | |||
+ bboxw + " " + bboxh + " rectclip\n"); | |||
preamble.append("newpath\n"); | |||
StringBuffer post = new StringBuffer(); | |||
@@ -164,8 +254,9 @@ public class FopPDFImage implements PDFImage { | |||
byte[] postBytes = post.toString().getBytes(); | |||
byte[] epsBytes = ((EPSImage)fopImage).getEPSImage(); | |||
int epsLength = epsBytes.length; | |||
byte[] imgData = new byte[preBytes.length + postBytes.length + | |||
epsLength]; | |||
byte[] imgData = new byte[preBytes.length | |||
+ postBytes.length | |||
+ epsLength]; | |||
System.arraycopy (preBytes, 0, imgData, 0, preBytes.length); | |||
System.arraycopy (epsBytes, 0, imgData, | |||
@@ -181,12 +272,22 @@ public class FopPDFImage implements PDFImage { | |||
return imgStream; | |||
} | |||
/** | |||
* @see org.apache.fop.pdf.PDFImage#getICCStream() | |||
*/ | |||
public PDFICCStream getICCStream() { | |||
return pdfICCStream; | |||
} | |||
protected PDFColorSpace toPDFColorSpace(ColorSpace cs) { | |||
if(cs == null) return null; | |||
/** | |||
* Converts a ColorSpace object to a PDFColorSpace object. | |||
* @param cs ColorSpace instance | |||
* @return PDFColorSpace new converted object | |||
*/ | |||
public static PDFColorSpace toPDFColorSpace(ColorSpace cs) { | |||
if (cs == null) { | |||
return null; | |||
} | |||
PDFColorSpace pdfCS = new PDFColorSpace(0); | |||
switch(cs.getType()) { |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.pdf; | |||
import org.apache.fop.render.XMLHandler; |
@@ -1,9 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2002 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.ps; | |||
import java.io.OutputStream; |
@@ -1,9 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2002 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.ps; | |||
import java.io.OutputStream; |
@@ -1,9 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.ps; | |||
/** |
@@ -1,9 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2002 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.ps; | |||
/** |
@@ -1,9 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2002 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.ps; | |||
import java.io.OutputStream; |
@@ -1,9 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.ps; | |||
import java.io.OutputStream; |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.ps; | |||
//Java |
@@ -1,9 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.ps; | |||
import java.io.IOException; |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.ps; | |||
import java.io.Serializable; |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.ps; | |||
//import org.apache.batik.gvt.TextNode; |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.ps; | |||
import org.apache.fop.render.XMLHandler; |
@@ -1,9 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2002 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.ps; | |||
import java.io.FilterOutputStream; |
@@ -1,24 +1,67 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.svg; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.area.*; | |||
import org.apache.fop.area.inline.*; | |||
import org.apache.fop.datatypes.ColorType; | |||
import org.apache.fop.image.*; | |||
import org.apache.fop.area.PageViewport; | |||
import org.apache.fop.area.Title; | |||
import org.apache.fop.area.inline.ForeignObject; | |||
import org.apache.fop.area.inline.Leader; | |||
import org.apache.fop.area.inline.Word; | |||
import org.apache.fop.svg.SVGUtilities; | |||
import org.apache.fop.layout.FontInfo; | |||
import org.apache.fop.fo.FOUserAgent; | |||
import org.apache.fop.fo.properties.RuleStyle; | |||
import org.w3c.dom.Node; | |||
import org.w3c.dom.ProcessingInstruction; | |||
import org.w3c.dom.svg.SVGSVGElement; | |||
import org.w3c.dom.svg.SVGDocument; | |||
import org.w3c.dom.Document; | |||
@@ -27,7 +70,6 @@ import org.w3c.dom.DOMImplementation; | |||
import org.w3c.dom.Text; | |||
import org.apache.batik.dom.svg.SVGDOMImplementation; | |||
import org.apache.batik.dom.svg.SVGOMElement; | |||
import org.apache.batik.dom.util.XMLSupport; | |||
import org.apache.batik.transcoder.svg2svg.SVGTranscoder; | |||
import org.apache.batik.transcoder.TranscoderInput; | |||
@@ -36,81 +78,94 @@ import org.apache.batik.transcoder.TranscoderException; | |||
import org.apache.batik.dom.util.DOMUtilities; | |||
import java.awt.Color; | |||
import java.awt.Image; | |||
import java.awt.image.BufferedImage; | |||
import java.awt.geom.Rectangle2D; | |||
import java.util.HashMap; | |||
import java.net.URL; | |||
import java.net.MalformedURLException; | |||
import java.io.OutputStream; | |||
import java.io.IOException; | |||
import java.io.OutputStreamWriter; | |||
import javax.swing.ImageIcon; | |||
import org.apache.fop.render.AbstractRenderer; | |||
import org.apache.fop.render.XMLHandler; | |||
import org.apache.fop.render.RendererContext; | |||
/** | |||
* This is the SVG renderer. | |||
*/ | |||
public class SVGRenderer extends AbstractRenderer implements XMLHandler { | |||
public static final String mimeType = "image/svg+xml"; | |||
static final String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI; | |||
Document svgDocument; | |||
Element svgRoot; | |||
Element currentPageG = null; | |||
Element lastLink = null; | |||
String lastViewbox = null; | |||
Element docDefs = null; | |||
Element pageDefs = null; | |||
Element pagesGroup = null; | |||
/** SVG MIME type */ | |||
public static final String SVG_MIME_TYPE = "image/svg+xml"; | |||
/** SVG namespace */ | |||
public static final String SVG_NAMESPACE = SVGDOMImplementation.SVG_NAMESPACE_URI; | |||
private Document svgDocument; | |||
private Element svgRoot; | |||
private Element currentPageG = null; | |||
private Element lastLink = null; | |||
private String lastViewbox = null; | |||
private Element docDefs = null; | |||
private Element pageDefs = null; | |||
private Element pagesGroup = null; | |||
// first sequence title | |||
Title docTitle = null; | |||
private Title docTitle = null; | |||
RendererContext context; | |||
private RendererContext context; | |||
OutputStream ostream; | |||
private OutputStream ostream; | |||
float totalWidth = 0; | |||
float totalHeight = 0; | |||
float sequenceWidth = 0; | |||
float sequenceHeight = 0; | |||
private float totalWidth = 0; | |||
private float totalHeight = 0; | |||
private float sequenceWidth = 0; | |||
private float sequenceHeight = 0; | |||
protected float pageWidth = 0; | |||
protected float pageHeight = 0; | |||
protected int pageNumber = 0; | |||
private float pageWidth = 0; | |||
private float pageHeight = 0; | |||
private int pageNumber = 0; | |||
protected HashMap fontNames = new HashMap(); | |||
protected HashMap fontStyles = new HashMap(); | |||
protected Color saveColor = null; | |||
private HashMap fontNames = new HashMap(); | |||
private HashMap fontStyles = new HashMap(); | |||
private Color saveColor = null; | |||
/** | |||
* The current (internal) font name | |||
*/ | |||
protected String currentFontName; | |||
private String currentFontName; | |||
/** | |||
* The current font size in millipoints | |||
*/ | |||
protected int currentFontSize; | |||
private int currentFontSize; | |||
/** | |||
* The current colour's red, green and blue component | |||
*/ | |||
protected float currentRed = 0; | |||
protected float currentGreen = 0; | |||
protected float currentBlue = 0; | |||
private float currentRed = 0; | |||
private float currentGreen = 0; | |||
private float currentBlue = 0; | |||
/** | |||
* Creates a new SVG renderer. | |||
*/ | |||
public SVGRenderer() { | |||
context = new RendererContext(mimeType); | |||
context = new RendererContext(SVG_MIME_TYPE); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#setUserAgent(FOUserAgent) | |||
*/ | |||
public void setUserAgent(FOUserAgent agent) { | |||
super.setUserAgent(agent); | |||
userAgent.setDefaultXMLHandler(mimeType, this); | |||
userAgent.addXMLHandler(mimeType, svgNS, this); | |||
userAgent.setDefaultXMLHandler(SVG_MIME_TYPE, this); | |||
userAgent.addXMLHandler(SVG_MIME_TYPE, SVG_NAMESPACE, this); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#setupFontInfo(FontInfo) | |||
*/ | |||
public void setupFontInfo(FontInfo fontInfo) { | |||
// create a temp Image to test font metrics on | |||
BufferedImage fontImage = | |||
@@ -119,32 +174,40 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler { | |||
fontImage.createGraphics()); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#setProducer(String) | |||
*/ | |||
public void setProducer(String producer) { | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#startRenderer(OutputStream) | |||
*/ | |||
public void startRenderer(OutputStream outputStream) | |||
throws IOException { | |||
throws IOException { | |||
ostream = outputStream; | |||
DOMImplementation impl = | |||
SVGDOMImplementation.getDOMImplementation(); | |||
svgDocument = impl.createDocument(svgNS, "svg", null); | |||
ProcessingInstruction pi = | |||
svgDocument.createProcessingInstruction("xml", " version=\"1.0\" encoding=\"ISO-8859-1\""); | |||
DOMImplementation impl = SVGDOMImplementation.getDOMImplementation(); | |||
svgDocument = impl.createDocument(SVG_NAMESPACE, "svg", null); | |||
svgRoot = svgDocument.getDocumentElement(); | |||
/* | |||
ProcessingInstruction pi = | |||
svgDocument.createProcessingInstruction("xml", | |||
" version=\"1.0\" encoding=\"ISO-8859-1\""); | |||
svgDocument.insertBefore(pi, svgRoot); | |||
*/ | |||
docDefs = svgDocument.createElementNS(svgNS, "defs"); | |||
docDefs = svgDocument.createElementNS(SVG_NAMESPACE, "defs"); | |||
svgRoot.appendChild(docDefs); | |||
pagesGroup = svgDocument.createElementNS(svgNS, "g"); | |||
pageDefs = svgDocument.createElementNS(svgNS, "defs"); | |||
pagesGroup = svgDocument.createElementNS(SVG_NAMESPACE, "g"); | |||
pageDefs = svgDocument.createElementNS(SVG_NAMESPACE, "defs"); | |||
pagesGroup.appendChild(pageDefs); | |||
svgRoot.appendChild(pagesGroup); | |||
} | |||
/** | |||
* | |||
* @see org.apache.fop.render.Renderer#stopRenderer() | |||
*/ | |||
public void stopRenderer() throws IOException { | |||
totalWidth += sequenceWidth; | |||
@@ -178,6 +241,9 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler { | |||
pageNumber = 0; | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#startPageSequence(Title) | |||
*/ | |||
public void startPageSequence(Title seqTitle) { | |||
totalWidth += sequenceWidth; | |||
if (sequenceHeight > totalHeight) { | |||
@@ -189,15 +255,17 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler { | |||
// convert first title to a string and set for svg document title | |||
docTitle = seqTitle; | |||
String str = convertTitleToString(seqTitle); | |||
Element svgTitle = svgDocument.createElementNS(svgNS, "title"); | |||
Element svgTitle = svgDocument.createElementNS(SVG_NAMESPACE, "title"); | |||
Text strNode = svgDocument.createTextNode(str); | |||
svgTitle.appendChild(strNode); | |||
svgRoot.insertBefore(svgTitle, svgRoot.getFirstChild()); | |||
} | |||
} | |||
public void renderPage(PageViewport page) throws IOException, | |||
FOPException { | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderPage(PageViewport) | |||
*/ | |||
public void renderPage(PageViewport page) throws IOException, FOPException { | |||
float lastWidth = pageWidth; | |||
float lastHeight = pageHeight; | |||
@@ -207,14 +275,15 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler { | |||
// if there is a link from the last page | |||
if (lastLink != null) { | |||
lastLink.setAttributeNS(null, "xlink:href", | |||
"#svgView(viewBox(" + totalWidth + ", "+ | |||
sequenceHeight + ", " + pageWidth + ", " + | |||
pageHeight + "))"); | |||
lastLink.setAttributeNS(null, "xlink:href", "#svgView(viewBox(" | |||
+ totalWidth + ", " | |||
+ sequenceHeight + ", " | |||
+ pageWidth + ", " | |||
+ pageHeight + "))"); | |||
pagesGroup.appendChild(lastLink); | |||
} | |||
currentPageG = svgDocument.createElementNS(svgNS, "svg"); | |||
currentPageG = svgDocument.createElementNS(SVG_NAMESPACE, "svg"); | |||
currentPageG.setAttributeNS(null, "viewbox", | |||
"0 0 " + (int) pageWidth + " " + (int) pageHeight); | |||
currentPageG.setAttributeNS(null, "width", | |||
@@ -239,61 +308,72 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler { | |||
// render the page contents | |||
super.renderPage(page); | |||
Element use = svgDocument.createElementNS(svgNS, "use"); | |||
Element use = svgDocument.createElementNS(SVG_NAMESPACE, "use"); | |||
use.setAttributeNS(null, "xlink:href", "#Page-" + pageNumber); | |||
use.setAttributeNS(null, "x", "" + totalWidth); | |||
use.setAttributeNS(null, "y", "" + (sequenceHeight - pageHeight)); | |||
pagesGroup.appendChild(use); | |||
Element lastPageLink = svgDocument.createElementNS(svgNS, "a"); | |||
Element lastPageLink = svgDocument.createElementNS(SVG_NAMESPACE, "a"); | |||
if (lastLink != null) { | |||
lastPageLink.setAttributeNS(null, "xlink:href", lastViewbox); | |||
} else { | |||
lastPageLink.setAttributeNS(null, "xlink:href", | |||
"#svgView(viewBox(" + totalWidth + ", " + | |||
(sequenceHeight - pageHeight) + ", " + pageWidth + | |||
", " + pageHeight + "))"); | |||
"#svgView(viewBox(" | |||
+ totalWidth + ", " | |||
+ (sequenceHeight - pageHeight) + ", " | |||
+ pageWidth + ", " | |||
+ pageHeight + "))"); | |||
} | |||
pagesGroup.appendChild(lastPageLink); | |||
// setup a link to the next page, only added when the | |||
// next page is rendered | |||
Element rect = SVGUtilities.createRect(svgDocument, totalWidth, | |||
(sequenceHeight - pageHeight), pageWidth / 2, pageHeight); | |||
(sequenceHeight - pageHeight), pageWidth / 2, pageHeight); | |||
rect.setAttributeNS(null, "style", "fill:blue;visibility:hidden"); | |||
lastPageLink.appendChild(rect); | |||
lastLink = svgDocument.createElementNS(svgNS, "a"); | |||
lastLink = svgDocument.createElementNS(SVG_NAMESPACE, "a"); | |||
rect = SVGUtilities.createRect(svgDocument, | |||
totalWidth + pageWidth / 2, | |||
(sequenceHeight - pageHeight), pageWidth / 2, pageHeight); | |||
rect.setAttributeNS(null, "style", "fill:blue;visibility:hidden"); | |||
lastLink.appendChild(rect); | |||
lastViewbox = "#svgView(viewBox(" + totalWidth + ", " + | |||
(sequenceHeight - pageHeight) + ", " + pageWidth + | |||
", " + pageHeight + "))"; | |||
lastViewbox = "#svgView(viewBox(" | |||
+ totalWidth + ", " | |||
+ (sequenceHeight - pageHeight) + ", " | |||
+ pageWidth + ", " | |||
+ pageHeight + "))"; | |||
pageNumber++; | |||
} | |||
/** | |||
* Method renderForeignObject. | |||
* @param fo the foreign object | |||
*/ | |||
public void renderForeignObject(ForeignObject fo) { | |||
Document doc = fo.getDocument(); | |||
String ns = fo.getNameSpace(); | |||
userAgent.renderXML(context, doc, ns); | |||
} | |||
/** | |||
* @see org.apache.fop.render.XMLHandler#handleXML(RendererContext, Document, String) | |||
*/ | |||
public void handleXML(RendererContext context, Document doc, | |||
String ns) throws Exception { | |||
if (svgNS.equals(ns)) { | |||
if (SVG_NAMESPACE.equals(ns)) { | |||
if (!(doc instanceof SVGDocument)) { | |||
DOMImplementation impl = | |||
SVGDOMImplementation.getDOMImplementation(); | |||
doc = DOMUtilities.deepCloneDocument(doc, impl); | |||
} | |||
SVGSVGElement svg = ((SVGDocument) doc).getRootElement(); | |||
Element view = svgDocument.createElementNS(svgNS, "svg"); | |||
Element view = svgDocument.createElementNS(SVG_NAMESPACE, "svg"); | |||
Node newsvg = svgDocument.importNode(svg, true); | |||
//view.setAttributeNS(null, "viewBox", "0 0 "); | |||
view.setAttributeNS(null, "x", | |||
@@ -303,7 +383,7 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler { | |||
// this fixes a problem where the xmlns is repeated sometimes | |||
Element ele = (Element) newsvg; | |||
ele.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns", | |||
svgNS); | |||
SVG_NAMESPACE); | |||
if (ele.hasAttributeNS(null, "xmlns")) { | |||
ele.removeAttributeNS(null, "xmlns"); | |||
} | |||
@@ -313,9 +393,12 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler { | |||
} | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderLeader(Leader) | |||
*/ | |||
public void renderLeader(Leader area) { | |||
String style = "stroke:black;stroke-width:" + | |||
(area.getRuleThickness() / 1000) + ";"; | |||
String style = "stroke:black;stroke-width:" | |||
+ (area.getRuleThickness() / 1000) + ";"; | |||
switch (area.getRuleStyle()) { | |||
case RuleStyle.DOTTED: | |||
style += "stroke-dasharray:1,1"; | |||
@@ -333,18 +416,21 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler { | |||
break; | |||
} | |||
Element line = SVGUtilities.createLine(svgDocument, | |||
currentBlockIPPosition / 1000, | |||
(currentBPPosition + area.getOffset() - | |||
area.getRuleThickness() / 2) / 1000, | |||
(currentBlockIPPosition + area.getWidth()) / 1000, | |||
(currentBPPosition + area.getOffset() - | |||
area.getRuleThickness() / 2) / 1000); | |||
currentBlockIPPosition / 1000, | |||
(currentBPPosition + area.getOffset() | |||
- area.getRuleThickness() / 2) / 1000, | |||
(currentBlockIPPosition + area.getWidth()) / 1000, | |||
(currentBPPosition + area.getOffset() | |||
- area.getRuleThickness() / 2) / 1000); | |||
line.setAttributeNS(null, "style", style); | |||
currentPageG.appendChild(line); | |||
super.renderLeader(area); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderWord(Word) | |||
*/ | |||
public void renderWord(Word word) { | |||
Element text = SVGUtilities.createText(svgDocument, | |||
currentBlockIPPosition / 1000, | |||
@@ -355,6 +441,9 @@ public class SVGRenderer extends AbstractRenderer implements XMLHandler { | |||
super.renderWord(word); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderCharacter(Character) | |||
*/ | |||
public void renderCharacter(org.apache.fop.area.inline.Character ch) { | |||
Element text = SVGUtilities.createText(svgDocument, | |||
currentBlockIPPosition / 1000, |
@@ -1,34 +1,63 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
// package com.eastpoint.chrysalis; | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.txt; | |||
// FOP | |||
import org.apache.fop.render.PrintRenderer; | |||
import org.apache.fop.render.pcl.*; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.fo.properties.*; | |||
import org.apache.fop.layout.*; | |||
import org.apache.fop.datatypes.*; | |||
import org.apache.fop.pdf.PDFPathPaint; | |||
import org.apache.fop.pdf.PDFColor; | |||
import org.apache.fop.image.*; | |||
import org.w3c.dom.svg.SVGSVGElement; | |||
import org.w3c.dom.svg.SVGDocument; | |||
// Java | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
import org.apache.fop.render.pcl.PCLStream; | |||
/** | |||
* Renderer that renders areas to plain text | |||
* | |||
* Created by Arthur E Welch III while at M&I EastPoint Technology | |||
* Modified by Mark Lillywhite mark-fop@inomial.com to use the new | |||
* Renderer interface. | |||
*/ | |||
@@ -37,91 +66,107 @@ public class TXTRenderer extends PrintRenderer { | |||
/** | |||
* the current stream to add Text commands to | |||
*/ | |||
PCLStream currentStream; | |||
private PCLStream currentStream; | |||
private int pageHeight = 7920; | |||
// These variables control the virtual paggination functionality. | |||
public int curdiv = 0; | |||
private int curdiv = 0; | |||
private int divisions = -1; | |||
private int paperheight = -1; // Paper height in decipoints? | |||
public int orientation = | |||
-1; // -1=default/unknown, 0=portrait, 1=landscape. | |||
public int topmargin = -1; // Top margin in decipoints? | |||
public int leftmargin = -1; // Left margin in decipoints? | |||
private int orientation = -1; // -1=default/unknown, 0=portrait, 1=landscape. | |||
private int topmargin = -1; // Top margin in decipoints? | |||
private int leftmargin = -1; // Left margin in decipoints? | |||
private int fullmargin = 0; | |||
final boolean debug = false; | |||
private final boolean debug = false; | |||
// Variables for rendering text. | |||
StringBuffer charData[]; | |||
StringBuffer decoData[]; | |||
public float textCPI = 16.67f; | |||
public float textLPI = 8; | |||
int maxX = (int)(8.5f * textCPI + 1); | |||
int maxY = (int)(11f * textLPI + 1); | |||
float xFactor; | |||
float yFactor; | |||
public String lineEnding = | |||
"\r\n"; // Every line except the last line on a page (which will end with pageEnding) will be terminated with this string. | |||
public String pageEnding = | |||
"\f"; // Every page except the last one will end with this string. | |||
public boolean suppressGraphics = | |||
false; // If true then graphics/decorations will not be rendered - text only. | |||
boolean firstPage = false; | |||
public TXTRenderer() {} | |||
private StringBuffer charData[]; | |||
private StringBuffer decoData[]; | |||
private float textCPI = 16.67f; | |||
private float textLPI = 8; | |||
private int maxX = (int)(8.5f * textCPI + 1); | |||
private int maxY = (int)(11f * textLPI + 1); | |||
private float xFactor; | |||
private float yFactor; | |||
/** | |||
* Every line except the last line on a page (which will end with | |||
* pageEnding) will be terminated with this string. | |||
*/ | |||
private String lineEnding = "\r\n"; | |||
/** | |||
* Every page except the last one will end with this string. | |||
*/ | |||
private String pageEnding = "\f"; | |||
/** | |||
* If true then graphics/decorations will not be rendered - text only. | |||
*/ | |||
private boolean suppressGraphics = false; | |||
private boolean firstPage = false; | |||
/** | |||
* set the TXT document's producer | |||
* Set the TXT document's producer | |||
* | |||
* @param producer string indicating application producing PDF | |||
*/ | |||
public void setProducer(String producer) {} | |||
public void setProducer(String producer) { | |||
} | |||
void addStr(int row, int col, String str, boolean ischar) { | |||
if (debug) | |||
private void addStr(int row, int col, String str, boolean ischar) { | |||
if (debug) { | |||
getLogger().debug("TXTRenderer.addStr(" + row + ", " + col | |||
+ ", \"" + str + "\", " + ischar + ")"); | |||
if (suppressGraphics &&!ischar) | |||
} | |||
if (suppressGraphics && !ischar) { | |||
return; | |||
} | |||
StringBuffer sb; | |||
if (row < 0) | |||
if (row < 0) { | |||
row = 0; | |||
if (ischar) | |||
} | |||
if (ischar) { | |||
sb = charData[row]; | |||
else | |||
} else { | |||
sb = decoData[row]; | |||
if (sb == null) | |||
} | |||
if (sb == null) { | |||
sb = new StringBuffer(); | |||
if ((col + str.length()) > maxX) | |||
} | |||
if ((col + str.length()) > maxX) { | |||
col = maxX - str.length(); | |||
} | |||
if (col < 0) { | |||
col = 0; | |||
if (str.length() > maxX) | |||
if (str.length() > maxX) { | |||
str = str.substring(0, maxX); | |||
} | |||
} | |||
// Pad to col | |||
for (int countr = sb.length(); countr < col; countr++) | |||
for (int countr = sb.length(); countr < col; countr++) { | |||
sb.append(' '); | |||
if (debug) | |||
} | |||
if (debug) { | |||
getLogger().debug("TXTRenderer.addStr() sb.length()=" | |||
+ sb.length()); | |||
} | |||
for (int countr = col; countr < (col + str.length()); countr++) { | |||
if (countr >= sb.length()) | |||
if (countr >= sb.length()) { | |||
sb.append(str.charAt(countr - col)); | |||
else { | |||
if (debug) | |||
} else { | |||
if (debug) { | |||
getLogger().debug("TXTRenderer.addStr() sb.length()=" | |||
+ sb.length() + " countr=" + countr); | |||
} | |||
sb.setCharAt(countr, str.charAt(countr - col)); | |||
} | |||
} | |||
if (ischar) | |||
if (ischar) { | |||
charData[row] = sb; | |||
else | |||
} else { | |||
decoData[row] = sb; | |||
} | |||
} | |||
} |
@@ -1,25 +1,82 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.txt; | |||
import java.io.*; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
/** | |||
* Helper class for text streams. | |||
*/ | |||
public class TXTStream { | |||
OutputStream out = null; | |||
boolean doOutput = true; | |||
private OutputStream out = null; | |||
private boolean doOutput = true; | |||
/** | |||
* Main constructor. | |||
* @param os OutputStream to write to | |||
*/ | |||
public TXTStream(OutputStream os) { | |||
out = os; | |||
} | |||
/** | |||
* Adds a String to the OutputStream | |||
* @param str String to add | |||
*/ | |||
public void add(String str) { | |||
if (!doOutput) | |||
if (!doOutput) { | |||
return; | |||
} | |||
try { | |||
byte buff[] = str.getBytes("UTF-8"); | |||
@@ -29,6 +86,10 @@ public class TXTStream { | |||
} | |||
} | |||
/** | |||
* Controls whether output is actually written. | |||
* @param doout true to enable output, false to suppress | |||
*/ | |||
public void setDoOutput(boolean doout) { | |||
doOutput = doout; | |||
} |
@@ -1,42 +1,98 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.xml; | |||
// FOP | |||
import org.apache.fop.svg.*; | |||
import org.apache.fop.render.Renderer; | |||
import org.apache.fop.render.AbstractRenderer; | |||
import org.apache.fop.render.RendererContext; | |||
import org.apache.fop.render.XMLHandler; | |||
import org.apache.fop.area.*; | |||
import org.apache.fop.area.inline.*; | |||
import org.apache.fop.pdf.*; | |||
import org.apache.fop.fo.properties.LeaderPattern; | |||
import org.apache.fop.fo.FOUserAgent; | |||
import org.apache.fop.layout.FontInfo; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.fo.properties.RuleStyle; | |||
// Avalon | |||
import org.apache.avalon.framework.logger.Logger; | |||
// Java | |||
import java.io.IOException; | |||
import java.io.PrintWriter; | |||
import java.io.OutputStream; | |||
import java.util.Enumeration; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.Iterator; | |||
import java.awt.geom.Rectangle2D; | |||
// XML | |||
import org.w3c.dom.Document; | |||
// FOP | |||
import org.apache.fop.render.AbstractRenderer; | |||
import org.apache.fop.render.RendererContext; | |||
import org.apache.fop.render.XMLHandler; | |||
import org.apache.fop.fo.FOUserAgent; | |||
import org.apache.fop.layout.FontInfo; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.area.BeforeFloat; | |||
import org.apache.fop.area.Block; | |||
import org.apache.fop.area.BodyRegion; | |||
import org.apache.fop.area.Flow; | |||
import org.apache.fop.area.Footnote; | |||
import org.apache.fop.area.LineArea; | |||
import org.apache.fop.area.MainReference; | |||
import org.apache.fop.area.PageViewport; | |||
import org.apache.fop.area.RegionReference; | |||
import org.apache.fop.area.RegionViewport; | |||
import org.apache.fop.area.Span; | |||
import org.apache.fop.area.Title; | |||
import org.apache.fop.area.Trait; | |||
import org.apache.fop.area.inline.Container; | |||
import org.apache.fop.area.inline.ForeignObject; | |||
import org.apache.fop.area.inline.Image; | |||
import org.apache.fop.area.inline.InlineArea; | |||
import org.apache.fop.area.inline.InlineParent; | |||
import org.apache.fop.area.inline.Leader; | |||
import org.apache.fop.area.inline.Space; | |||
import org.apache.fop.area.inline.Viewport; | |||
import org.apache.fop.area.inline.Word; | |||
import org.apache.fop.fo.properties.RuleStyle; | |||
/** | |||
* Renderer that renders areas to XML for debugging purposes. | |||
* This creates an xml that contains the information of the area | |||
@@ -45,11 +101,16 @@ import org.w3c.dom.Document; | |||
* which can be rendered to any renderer. | |||
*/ | |||
public class XMLRenderer extends AbstractRenderer { | |||
public static final String mimeType = "text/xml"; | |||
/** XML MIME type */ | |||
public static final String XML_MIME_TYPE = "text/xml"; | |||
boolean startedSequence = false; | |||
RendererContext context; | |||
private boolean startedSequence = false; | |||
private RendererContext context; | |||
/** | |||
* @see org.apache.fop.render.Renderer#setProducer(String) | |||
*/ | |||
public void setProducer(String producer) { | |||
} | |||
@@ -73,19 +134,25 @@ public class XMLRenderer extends AbstractRenderer { | |||
*/ | |||
private boolean consistentOutput = false; | |||
/** | |||
* Creates a new XML renderer. | |||
*/ | |||
public XMLRenderer() { | |||
context = new RendererContext(mimeType); | |||
context = new RendererContext(XML_MIME_TYPE); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#setUserAgent(FOUserAgent) | |||
*/ | |||
public void setUserAgent(FOUserAgent agent) { | |||
super.setUserAgent(agent); | |||
// | |||
//userAgent.addExtensionHandler(); | |||
XMLHandler handler = new XMLXMLHandler(); | |||
userAgent.setDefaultXMLHandler(mimeType, handler); | |||
userAgent.setDefaultXMLHandler(XML_MIME_TYPE, handler); | |||
String svg = "http://www.w3.org/2000/svg"; | |||
userAgent.addXMLHandler(mimeType, svg, handler); | |||
userAgent.addXMLHandler(XML_MIME_TYPE, svg, handler); | |||
} | |||
/** | |||
@@ -157,17 +224,19 @@ public class XMLRenderer extends AbstractRenderer { | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#startRenderer(OutputStream) | |||
*/ | |||
public void startRenderer(OutputStream outputStream) | |||
throws IOException { | |||
throws IOException { | |||
getLogger().debug("rendering areas to XML"); | |||
this.writer = new PrintWriter(outputStream); | |||
this.writer.write( "<?xml version=\"1.0\"?>\n<!-- produced by " + | |||
this.producer + " -->\n"); | |||
this.writer.write("<?xml version=\"1.0\"?>\n" | |||
+ "<!-- produced by " + this.producer + " -->\n"); | |||
writeStartTag("<areaTree>"); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#stopRenderer() | |||
*/ | |||
public void stopRenderer() throws IOException { | |||
writeEndTag("</pageSequence>"); | |||
@@ -176,10 +245,12 @@ public class XMLRenderer extends AbstractRenderer { | |||
getLogger().debug("written out XML"); | |||
} | |||
public void renderPage(PageViewport page) throws IOException, | |||
FOPException { | |||
writeStartTag("<pageViewport bounds=\"" + | |||
createString(page.getViewArea()) + "\">"); | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderPage(PageViewport) | |||
*/ | |||
public void renderPage(PageViewport page) throws IOException, FOPException { | |||
writeStartTag("<pageViewport bounds=\"" | |||
+ createString(page.getViewArea()) + "\">"); | |||
writeStartTag("<page>"); | |||
super.renderPage(page); | |||
writeEndTag("</page>"); | |||
@@ -187,10 +258,13 @@ public class XMLRenderer extends AbstractRenderer { | |||
} | |||
private String createString(Rectangle2D rect) { | |||
return "" + (int) rect.getX() + " " + (int) rect.getY() + " " + | |||
(int) rect.getWidth() + " " + (int) rect.getHeight(); | |||
return "" + (int) rect.getX() + " " + (int) rect.getY() + " " | |||
+ (int) rect.getWidth() + " " + (int) rect.getHeight(); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#startPageSequence(Title) | |||
*/ | |||
public void startPageSequence(Title seqTitle) { | |||
if (startedSequence) { | |||
writeEndTag("</pageSequence>"); | |||
@@ -210,10 +284,13 @@ public class XMLRenderer extends AbstractRenderer { | |||
} | |||
} | |||
/** | |||
* @see org.apache.fop.render.AbstractRenderer#renderRegionViewport(RegionViewport) | |||
*/ | |||
protected void renderRegionViewport(RegionViewport port) { | |||
if (port != null) { | |||
writeStartTag("<regionViewport rect=\"" + | |||
createString(port.getViewArea()) + "\">"); | |||
writeStartTag("<regionViewport rect=\"" | |||
+ createString(port.getViewArea()) + "\">"); | |||
RegionReference region = port.getRegion(); | |||
if (region.getRegionClass() == RegionReference.BEFORE) { | |||
writeStartTag("<regionBefore>"); | |||
@@ -240,21 +317,30 @@ public class XMLRenderer extends AbstractRenderer { | |||
} | |||
} | |||
/** | |||
* @see org.apache.fop.render.AbstractRenderer#renderBeforeFloat(BeforeFloat) | |||
*/ | |||
protected void renderBeforeFloat(BeforeFloat bf) { | |||
writeStartTag("<beforeFloat>"); | |||
super.renderBeforeFloat(bf); | |||
writeEndTag("</beforeFloat>"); | |||
} | |||
/** | |||
* @see org.apache.fop.render.AbstractRenderer#renderFootnote(Footnote) | |||
*/ | |||
protected void renderFootnote(Footnote footnote) { | |||
writeStartTag("<footnote>"); | |||
super.renderFootnote(footnote); | |||
writeEndTag("</footnote>"); | |||
} | |||
/** | |||
* @see org.apache.fop.render.AbstractRenderer#renderMainReference(MainReference) | |||
*/ | |||
protected void renderMainReference(MainReference mr) { | |||
writeStartTag("<mainReference columnGap=\"" + | |||
mr.getColumnGap() + "\" width=\"" + mr.getWidth() + "\">"); | |||
writeStartTag("<mainReference columnGap=\"" | |||
+ mr.getColumnGap() + "\" width=\"" + mr.getWidth() + "\">"); | |||
Span span = null; | |||
List spans = mr.getSpans(); | |||
@@ -271,13 +357,19 @@ public class XMLRenderer extends AbstractRenderer { | |||
writeEndTag("</mainReference>"); | |||
} | |||
// the normal flow reference area contains stacked blocks | |||
/** | |||
* @see org.apache.fop.render.AbstractRenderer#renderFlow(Flow) | |||
*/ | |||
protected void renderFlow(Flow flow) { | |||
// the normal flow reference area contains stacked blocks | |||
writeStartTag("<flow>"); | |||
super.renderFlow(flow); | |||
writeEndTag("</flow>"); | |||
} | |||
/** | |||
* @see org.apache.fop.render.AbstractRenderer#renderBlock(Block) | |||
*/ | |||
protected void renderBlock(Block block) { | |||
String prop = ""; | |||
Map map = block.getTraits(); | |||
@@ -289,28 +381,41 @@ public class XMLRenderer extends AbstractRenderer { | |||
writeEndTag("</block>"); | |||
} | |||
/** | |||
* @see org.apache.fop.render.AbstractRenderer#renderLineArea(LineArea) | |||
*/ | |||
protected void renderLineArea(LineArea line) { | |||
String prop = ""; | |||
Map map = line.getTraits(); | |||
if (map != null) { | |||
prop = " props=\"" + getPropString(map) + "\""; | |||
} | |||
writeStartTag("<lineArea height=\"" + line.getHeight() + "\"" + | |||
prop + ">"); | |||
writeStartTag("<lineArea height=\"" + line.getHeight() + "\"" | |||
+ prop + ">"); | |||
super.renderLineArea(line); | |||
writeEndTag("</lineArea>"); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderViewport(Viewport) | |||
*/ | |||
public void renderViewport(Viewport viewport) { | |||
writeStartTag("<viewport>"); | |||
super.renderViewport(viewport); | |||
writeEndTag("</viewport>"); | |||
} | |||
/** | |||
* Renders an image | |||
* @param image the image | |||
*/ | |||
public void renderImage(Image image) { | |||
writeElement("<image url=\"" + image.getURL() + "\"/>"); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderContainer(Container) | |||
*/ | |||
public void renderContainer(Container cont) { | |||
writeStartTag("<container>"); | |||
@@ -318,6 +423,10 @@ public class XMLRenderer extends AbstractRenderer { | |||
writeEndTag("</container>"); | |||
} | |||
/** | |||
* Renders an fo:foreing-object. | |||
* @param fo the foreign object | |||
*/ | |||
public void renderForeignObject(ForeignObject fo) { | |||
writeStartTag("<foreignObject>"); | |||
Document doc = fo.getDocument(); | |||
@@ -327,6 +436,9 @@ public class XMLRenderer extends AbstractRenderer { | |||
writeEndTag("</foreignObject>"); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderCharacter(Character) | |||
*/ | |||
public void renderCharacter(org.apache.fop.area.inline.Character ch) { | |||
String prop = ""; | |||
Map map = ch.getTraits(); | |||
@@ -336,21 +448,30 @@ public class XMLRenderer extends AbstractRenderer { | |||
writeElement("<char" + prop + ">" + ch.getChar() + "</char>"); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderInlineSpace(Space) | |||
*/ | |||
public void renderInlineSpace(Space space) { | |||
writeElement("<space width=\"" + space.getWidth() + "\"/>"); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderWord(Word) | |||
*/ | |||
public void renderWord(Word word) { | |||
String prop = ""; | |||
Map map = word.getTraits(); | |||
if (map != null) { | |||
prop = " props=\"" + getPropString(map) + "\""; | |||
} | |||
writeElement("<word wsadjust=\"" + word.getWSadjust() + "\"" + | |||
prop + ">" + word.getWord() + "</word>"); | |||
writeElement("<word wsadjust=\"" + word.getWSadjust() + "\"" | |||
+ prop + ">" + word.getWord() + "</word>"); | |||
super.renderWord(word); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderInlineParent(InlineParent) | |||
*/ | |||
public void renderInlineParent(InlineParent ip) { | |||
String prop = ""; | |||
Map map = ip.getTraits(); | |||
@@ -362,6 +483,9 @@ public class XMLRenderer extends AbstractRenderer { | |||
writeEndTag("</inlineparent>"); | |||
} | |||
/** | |||
* @see org.apache.fop.render.Renderer#renderLeader(Leader) | |||
*/ | |||
public void renderLeader(Leader area) { | |||
String style = "solid"; | |||
switch (area.getRuleStyle()) { | |||
@@ -383,22 +507,29 @@ public class XMLRenderer extends AbstractRenderer { | |||
style = "ridge"; | |||
break; | |||
} | |||
writeElement("<leader width=\"" + area.getWidth() + "\" ruleStyle=\"" + style + | |||
"\" ruleThickness=\"" + area.getRuleThickness() + "\"/>"); | |||
writeElement("<leader width=\"" + area.getWidth() | |||
+ "\" ruleStyle=\"" + style | |||
+ "\" ruleThickness=\"" + area.getRuleThickness() | |||
+ "\"/>"); | |||
super.renderLeader(area); | |||
} | |||
/** | |||
* Builds a String with attributes from the trait map. | |||
* @param traitMap the trait map | |||
* @return String the generated attributes | |||
*/ | |||
protected String getPropString(Map traitMap) { | |||
StringBuffer strbuf = new StringBuffer(); | |||
Iterator iter = traitMap.entrySet().iterator(); | |||
while (iter.hasNext()) { | |||
Iterator iter = traitMap.entrySet().iterator(); | |||
while (iter.hasNext()) { | |||
Map.Entry traitEntry = (Map.Entry) iter.next(); | |||
strbuf.append(Trait.getTraitName(traitEntry.getKey())); | |||
strbuf.append(':'); | |||
strbuf.append(traitEntry.getValue().toString()); | |||
strbuf.append(';'); | |||
} | |||
return strbuf.toString(); | |||
strbuf.append(Trait.getTraitName(traitEntry.getKey())); | |||
strbuf.append(':'); | |||
strbuf.append(traitEntry.getValue().toString()); | |||
strbuf.append(';'); | |||
} | |||
return strbuf.toString(); | |||
} | |||
} |
@@ -1,13 +1,55 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.render.xml; | |||
import org.apache.fop.fo.FOUserAgent; | |||
import org.apache.fop.render.XMLHandler; | |||
import org.apache.fop.render.RendererContext; | |||
@@ -22,13 +64,16 @@ import java.io.Writer; | |||
import java.io.IOException; | |||
/** | |||
* XML handler for the XML renderer. | |||
*/ | |||
public class XMLXMLHandler implements XMLHandler { | |||
public static final String WRITER = "writer"; | |||
public XMLXMLHandler() { | |||
} | |||
/** Key for getting the Writer from the RendererContext */ | |||
public static final String WRITER = "writer"; | |||
/** | |||
* @see org.apache.fop.render.XMLHandler#handleXML(RendererContext, Document, String) | |||
*/ | |||
public void handleXML(RendererContext context, Document doc, | |||
String ns) throws Exception { | |||
Writer writer = (Writer) context.getProperty(WRITER); | |||
@@ -46,84 +91,93 @@ public static final String WRITER = "writer"; | |||
/** | |||
* Writes the given document using the given writer. | |||
* @param doc DOM document | |||
* @param writer Writer to write to | |||
* @throws IOException In case of an I/O problem | |||
*/ | |||
public static void writeDocument(Document doc, | |||
Writer w) throws IOException { | |||
Writer writer) throws IOException { | |||
for (Node n = doc.getFirstChild(); n != null; | |||
n = n.getNextSibling()) { | |||
writeNode(n, w); | |||
writeNode(n, writer); | |||
} | |||
} | |||
/** | |||
* Writes a node using the given writer. | |||
* @param node node to serialize | |||
* @param writer Writer to write to | |||
* @throws IOException In case of an I/O problem | |||
*/ | |||
public static void writeNode(Node n, Writer w) throws IOException { | |||
switch (n.getNodeType()) { | |||
public static void writeNode(Node node, Writer writer) throws IOException { | |||
switch (node.getNodeType()) { | |||
case Node.ELEMENT_NODE: | |||
w.write("<"); | |||
w.write(n.getNodeName()); | |||
writer.write("<"); | |||
writer.write(node.getNodeName()); | |||
if (n.hasAttributes()) { | |||
NamedNodeMap attr = n.getAttributes(); | |||
if (node.hasAttributes()) { | |||
NamedNodeMap attr = node.getAttributes(); | |||
int len = attr.getLength(); | |||
for (int i = 0; i < len; i++) { | |||
Attr a = (Attr) attr.item(i); | |||
w.write(" "); | |||
w.write(a.getNodeName()); | |||
w.write("=\""); | |||
w.write(contentToString(a.getNodeValue())); | |||
w.write("\""); | |||
writer.write(" "); | |||
writer.write(a.getNodeName()); | |||
writer.write("=\""); | |||
writer.write(contentToString(a.getNodeValue())); | |||
writer.write("\""); | |||
} | |||
} | |||
Node c = n.getFirstChild(); | |||
Node c = node.getFirstChild(); | |||
if (c != null) { | |||
w.write(">"); | |||
writer.write(">"); | |||
for (; c != null; c = c.getNextSibling()) { | |||
writeNode(c, w); | |||
writeNode(c, writer); | |||
} | |||
w.write("</"); | |||
w.write(n.getNodeName()); | |||
w.write(">"); | |||
writer.write("</"); | |||
writer.write(node.getNodeName()); | |||
writer.write(">"); | |||
} else { | |||
w.write("/>"); | |||
writer.write("/>"); | |||
} | |||
break; | |||
case Node.TEXT_NODE: | |||
w.write(contentToString(n.getNodeValue())); | |||
writer.write(contentToString(node.getNodeValue())); | |||
break; | |||
case Node.CDATA_SECTION_NODE: | |||
w.write("<![CDATA["); | |||
w.write(n.getNodeValue()); | |||
w.write("]]>"); | |||
writer.write("<![CDATA["); | |||
writer.write(node.getNodeValue()); | |||
writer.write("]]>"); | |||
break; | |||
case Node.ENTITY_REFERENCE_NODE: | |||
w.write("&"); | |||
w.write(n.getNodeName()); | |||
w.write(";"); | |||
writer.write("&"); | |||
writer.write(node.getNodeName()); | |||
writer.write(";"); | |||
break; | |||
case Node.PROCESSING_INSTRUCTION_NODE: | |||
w.write("<?"); | |||
w.write(n.getNodeName()); | |||
w.write(n.getNodeValue()); | |||
w.write("?>"); | |||
writer.write("<?"); | |||
writer.write(node.getNodeName()); | |||
writer.write(node.getNodeValue()); | |||
writer.write("?>"); | |||
break; | |||
case Node.COMMENT_NODE: | |||
w.write("<!--"); | |||
w.write(n.getNodeValue()); | |||
w.write("-->"); | |||
writer.write("<!--"); | |||
writer.write(node.getNodeValue()); | |||
writer.write("-->"); | |||
break; | |||
case Node.DOCUMENT_TYPE_NODE: | |||
break; | |||
default: | |||
throw new Error("Internal error (" + n.getNodeType() + ")"); | |||
throw new IllegalArgumentException("Unexpected node type (" | |||
+ node.getNodeType() + ")"); | |||
} | |||
} | |||
/** | |||
* Returns the given content value transformed to replace invalid | |||
* characters with entities. | |||
* @param s content value | |||
* @return encoded value | |||
*/ | |||
public static String contentToString(String s) { | |||
StringBuffer result = new StringBuffer(); |
@@ -1,120 +1,202 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.rtf.renderer; | |||
// Java | |||
import java.io.OutputStream; | |||
import java.io.OutputStreamWriter; | |||
import java.io.IOException; | |||
// XML | |||
import org.xml.sax.SAXException; | |||
// FOP | |||
import org.apache.fop.apps.StructureHandler; | |||
import org.apache.fop.layout.FontInfo; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.fo.pagination.PageSequence; | |||
import org.apache.fop.fo.pagination.LayoutMasterSet; | |||
import org.apache.fop.fo.pagination.SimplePageMaster; | |||
import org.apache.fop.fo.Title; | |||
import org.apache.fop.fo.flow.Block; | |||
import org.apache.fop.fo.flow.Flow; | |||
// JFOR | |||
import org.jfor.jfor.rtflib.rtfdoc.RtfFile; | |||
import org.jfor.jfor.rtflib.rtfdoc.RtfSection; | |||
import org.jfor.jfor.rtflib.rtfdoc.RtfParagraph; | |||
import org.jfor.jfor.rtflib.rtfdoc.RtfDocumentArea; | |||
import org.xml.sax.SAXException; | |||
import java.io.OutputStream; | |||
import java.io.OutputStreamWriter; | |||
import java.io.IOException; | |||
/** | |||
* RTF Handler: generates RTF output using the structure events from | |||
* the FO Tree sent to this structure handler. | |||
* | |||
* @author bdelacretaz@apache.org | |||
* @author bdelacretaz@apache.org | |||
*/ | |||
public class RTFHandler extends StructureHandler { | |||
private FontInfo _fontInfo = new FontInfo(); | |||
private RtfFile _rtfFile; | |||
private final OutputStream _os; | |||
private RtfSection _sect; | |||
private RtfDocumentArea _docArea; | |||
private RtfParagraph _para; | |||
private boolean _warned = false; | |||
private static final String ALPHA_WARNING = "WARNING: RTF renderer is veryveryalpha at this time, see class org.apache.fop.rtf.renderer.RTFHandler"; | |||
public class RTFHandler extends StructureHandler { | |||
private FontInfo fontInfo = new FontInfo(); | |||
private RtfFile rtfFile; | |||
private final OutputStream os; | |||
private RtfSection sect; | |||
private RtfDocumentArea docArea; | |||
private RtfParagraph para; | |||
private boolean warned = false; | |||
private static final String ALPHA_WARNING = "WARNING: RTF renderer is " | |||
+ "veryveryalpha at this time, see class org.apache.fop.rtf.renderer.RTFHandler"; | |||
/** | |||
* Creates a new RTF structure handler. | |||
* @param os OutputStream to write to | |||
*/ | |||
public RTFHandler(OutputStream os) { | |||
_os = os; | |||
this.os = os; | |||
// use pdf fonts for now, this is only for resolving names | |||
org.apache.fop.render.pdf.FontSetup.setup(_fontInfo, null); | |||
org.apache.fop.render.pdf.FontSetup.setup(fontInfo, null); | |||
System.err.println(ALPHA_WARNING); | |||
} | |||
/** | |||
* @see org.apache.fop.apps.StructureHandler#getFontInfo() | |||
*/ | |||
public FontInfo getFontInfo() { | |||
return _fontInfo; | |||
return this.fontInfo; | |||
} | |||
/** | |||
* @see org.apache.fop.apps.StructureHandler#startDocument() | |||
*/ | |||
public void startDocument() throws SAXException { | |||
// FIXME sections should be created | |||
try { | |||
_rtfFile = new RtfFile(new OutputStreamWriter(_os)); | |||
_docArea = _rtfFile.startDocumentArea(); | |||
} catch(IOException ioe) { | |||
rtfFile = new RtfFile(new OutputStreamWriter(os)); | |||
docArea = rtfFile.startDocumentArea(); | |||
} catch (IOException ioe) { | |||
// FIXME could we throw Exception in all StructureHandler events? | |||
throw new SAXException("IOException: " + ioe); | |||
} | |||
} | |||
/** | |||
* @see org.apache.fop.apps.StructureHandler#endDocument() | |||
*/ | |||
public void endDocument() throws SAXException { | |||
try { | |||
_rtfFile.flush(); | |||
} catch(IOException ioe) { | |||
rtfFile.flush(); | |||
} catch (IOException ioe) { | |||
// FIXME could we throw Exception in all StructureHandler events? | |||
throw new SAXException("IOException: " + ioe); | |||
} | |||
} | |||
/** | |||
* @see org.apache.fop.apps.StructureHandler | |||
*/ | |||
public void startPageSequence(PageSequence pageSeq, Title seqTitle, LayoutMasterSet lms) { | |||
try { | |||
_sect = _docArea.newSection(); | |||
if(!_warned) { | |||
_sect.newParagraph().newText(ALPHA_WARNING); | |||
_warned = true; | |||
sect = docArea.newSection(); | |||
if (!warned) { | |||
sect.newParagraph().newText(ALPHA_WARNING); | |||
warned = true; | |||
} | |||
} catch(IOException ioe) { | |||
} catch (IOException ioe) { | |||
// FIXME could we throw Exception in all StructureHandler events? | |||
throw new Error("IOException: " + ioe); | |||
} | |||
} | |||
/** | |||
* @see org.apache.fop.apps.StructureHandler#endPageSequence(PageSequence) | |||
*/ | |||
public void endPageSequence(PageSequence pageSeq) throws FOPException { | |||
} | |||
/** | |||
* @see org.apache.fop.apps.StructureHandler#startFlow(Flow) | |||
*/ | |||
public void startFlow(Flow fl) { | |||
} | |||
/** | |||
* @see org.apache.fop.apps.StructureHandler#endFlow(Flow) | |||
*/ | |||
public void endFlow(Flow fl) { | |||
} | |||
/** | |||
* @see org.apache.fop.apps.StructureHandler#startBlock(Block) | |||
*/ | |||
public void startBlock(Block bl) { | |||
try { | |||
_para = _sect.newParagraph(); | |||
} catch(IOException ioe) { | |||
para = sect.newParagraph(); | |||
} catch (IOException ioe) { | |||
// FIXME could we throw Exception in all StructureHandler events? | |||
throw new Error("IOException: " + ioe); | |||
} | |||
} | |||
/** | |||
* @see org.apache.fop.apps.StructureHandler#endBlock(Block) | |||
*/ | |||
public void endBlock(Block bl) { | |||
} | |||
/** | |||
* @see org.apache.fop.apps.StructureHandler#characters(char[], int, int) | |||
*/ | |||
public void characters(char data[], int start, int length) { | |||
try { | |||
_para.newText(new String(data,start,length)); | |||
} catch(IOException ioe) { | |||
para.newText(new String(data, start, length)); | |||
} catch (IOException ioe) { | |||
// FIXME could we throw Exception in all StructureHandler events? | |||
throw new Error("IOException: " + ioe); | |||
} |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2002-2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.servlet; | |||
import java.io.File; |
@@ -1,10 +1,53 @@ | |||
/* | |||
* $Id$ | |||
* Copyright (C) 2001-2003 The Apache Software Foundation. All rights reserved. | |||
* For details on use and redistribution please refer to the | |||
* LICENSE file included with these sources. | |||
*/ | |||
* ============================================================================ | |||
* The Apache Software License, Version 1.1 | |||
* ============================================================================ | |||
* | |||
* Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved. | |||
* | |||
* Redistribution and use in source and binary forms, with or without modifica- | |||
* tion, are permitted provided that the following conditions are met: | |||
* | |||
* 1. Redistributions of source code must retain the above copyright notice, | |||
* this list of conditions and the following disclaimer. | |||
* | |||
* 2. Redistributions in binary form must reproduce the above copyright notice, | |||
* this list of conditions and the following disclaimer in the documentation | |||
* and/or other materials provided with the distribution. | |||
* | |||
* 3. The end-user documentation included with the redistribution, if any, must | |||
* include the following acknowledgment: "This product includes software | |||
* developed by the Apache Software Foundation (http://www.apache.org/)." | |||
* Alternately, this acknowledgment may appear in the software itself, if | |||
* and wherever such third-party acknowledgments normally appear. | |||
* | |||
* 4. The names "FOP" and "Apache Software Foundation" must not be used to | |||
* endorse or promote products derived from this software without prior | |||
* written permission. For written permission, please contact | |||
* apache@apache.org. | |||
* | |||
* 5. Products derived from this software may not be called "Apache", nor may | |||
* "Apache" appear in their name, without prior written permission of the | |||
* Apache Software Foundation. | |||
* | |||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | |||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | |||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | |||
* APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU- | |||
* DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS | |||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||
* ============================================================================ | |||
* | |||
* This software consists of voluntary contributions made by many individuals | |||
* on behalf of the Apache Software Foundation and was originally created by | |||
* James Tauber <jtauber@jtauber.com>. For more information on the Apache | |||
* Software Foundation, please see <http://www.apache.org/>. | |||
*/ | |||
package org.apache.fop.servlet; | |||
import java.io.ByteArrayOutputStream; |