Browse Source

Switched to long licence

Some general checkstyle fixing


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196040 13f79535-47bb-0310-9956-ffa450edef68
pull/30/head
Jeremias Maerki 21 years ago
parent
commit
080758135d
38 changed files with 2504 additions and 577 deletions
  1. 56
    8
      src/org/apache/fop/render/AbstractRenderer.java
  2. 51
    6
      src/org/apache/fop/render/PrintRenderer.java
  3. 48
    4
      src/org/apache/fop/render/Renderer.java
  4. 48
    4
      src/org/apache/fop/render/RendererContext.java
  5. 48
    4
      src/org/apache/fop/render/XMLHandler.java
  6. 48
    5
      src/org/apache/fop/render/awt/AWTFontMetrics.java
  7. 67
    43
      src/org/apache/fop/render/awt/AWTRenderer.java
  8. 48
    5
      src/org/apache/fop/render/awt/FontMetricsMapper.java
  9. 48
    5
      src/org/apache/fop/render/awt/FontSetup.java
  10. 69
    38
      src/org/apache/fop/render/pcl/PCLRenderer.java
  11. 57
    10
      src/org/apache/fop/render/pcl/PCLStream.java
  12. 64
    22
      src/org/apache/fop/render/pdf/CTMHelper.java
  13. 48
    5
      src/org/apache/fop/render/pdf/EmbedFontInfo.java
  14. 71
    7
      src/org/apache/fop/render/pdf/FontReader.java
  15. 48
    5
      src/org/apache/fop/render/pdf/FontSetup.java
  16. 68
    5
      src/org/apache/fop/render/pdf/FontTriplet.java
  17. 133
    32
      src/org/apache/fop/render/pdf/FopPDFImage.java
  18. 48
    5
      src/org/apache/fop/render/pdf/PDFXMLHandler.java
  19. 48
    4
      src/org/apache/fop/render/ps/ASCII85OutputStream.java
  20. 48
    4
      src/org/apache/fop/render/ps/ASCIIHexOutputStream.java
  21. 48
    4
      src/org/apache/fop/render/ps/DSCConstants.java
  22. 48
    4
      src/org/apache/fop/render/ps/Finalizable.java
  23. 48
    4
      src/org/apache/fop/render/ps/FlateEncodeOutputStream.java
  24. 48
    4
      src/org/apache/fop/render/ps/PSGenerator.java
  25. 48
    5
      src/org/apache/fop/render/ps/PSGraphics2D.java
  26. 48
    4
      src/org/apache/fop/render/ps/PSProcSets.java
  27. 48
    5
      src/org/apache/fop/render/ps/PSState.java
  28. 48
    5
      src/org/apache/fop/render/ps/PSTextElementBridge.java
  29. 48
    5
      src/org/apache/fop/render/ps/PSXMLHandler.java
  30. 48
    4
      src/org/apache/fop/render/ps/RunLengthEncodeOutputStream.java
  31. 175
    86
      src/org/apache/fop/render/svg/SVGRenderer.java
  32. 108
    63
      src/org/apache/fop/render/txt/TXTRenderer.java
  33. 70
    9
      src/org/apache/fop/render/txt/TXTStream.java
  34. 189
    58
      src/org/apache/fop/render/xml/XMLRenderer.java
  35. 99
    45
      src/org/apache/fop/render/xml/XMLXMLHandler.java
  36. 123
    41
      src/org/apache/fop/rtf/renderer/RTFHandler.java
  37. 48
    5
      src/org/apache/fop/servlet/FopPrintServlet.java
  38. 48
    5
      src/org/apache/fop/servlet/FopServlet.java

+ 56
- 8
src/org/apache/fop/render/AbstractRenderer.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render;


// Java // Java
*/ */
protected int containingIPPosition = 0; 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 */ /** @see org.apache.fop.render.Renderer */
public void setProducer(String producer) { public void setProducer(String producer) {
} }
* This should be overridden to draw border and background * This should be overridden to draw border and background
* traits for the viewport area. * traits for the viewport area.
* *
* @param vp the region viewport area
* @param rv the region viewport area
*/ */
protected void handleViewportTraits(RegionViewport rv) { protected void handleViewportTraits(RegionViewport rv) {
// draw border and background // draw border and background
protected void renderFlow(Flow flow) { protected void renderFlow(Flow flow) {
// the normal flow reference area contains stacked blocks // the normal flow reference area contains stacked blocks
List blocks = flow.getChildAreas(); List blocks = flow.getChildAreas();
if(blocks != null) {
if (blocks != null) {
renderBlocks(blocks); renderBlocks(blocks);
} }
} }
} }
} }


public void configure(Configuration conf) throws ConfigurationException {
}
} }



+ 51
- 6
src/org/apache/fop/render/PrintRenderer.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render;


// FOP // FOP
import org.apache.fop.layout.FontInfo; import org.apache.fop.layout.FontInfo;


// Java // Java
import java.util.ArrayList;
import java.util.List;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;


/** Font configuration */ /** Font configuration */
protected FontInfo fontInfo; protected FontInfo fontInfo;


protected ArrayList fontList = null;
/** list of fonts */
protected List fontList = null;


/** /**
* Set up the font info * Set up the font info

+ 48
- 4
src/org/apache/fop/render/Renderer.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render;


// Java // Java

+ 48
- 4
src/org/apache/fop/render/RendererContext.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render;


//Java //Java

+ 48
- 4
src/org/apache/fop/render/XMLHandler.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render;


import org.w3c.dom.Document; import org.w3c.dom.Document;

+ 48
- 5
src/org/apache/fop/render/awt/AWTFontMetrics.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.awt;


// Java // Java

+ 67
- 43
src/org/apache/fop/render/awt/AWTRenderer.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.awt;


/* /*
* Stanislav Gorkhover: Stanislav.Gorkhover@jCatalog.com * 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.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.render.AbstractRenderer;
import org.apache.fop.viewer.Translator;


/** /**
*/
* This is FOP's AWT renderer.
*/
public class AWTRenderer extends AbstractRenderer implements Printable, Pageable { public class AWTRenderer extends AbstractRenderer implements Printable, Pageable {


protected int pageWidth = 0; protected int pageWidth = 0;
protected int pageHeight = 0; protected int pageHeight = 0;
protected double scaleFactor = 100.0; protected double scaleFactor = 100.0;
protected int pageNumber = 0; protected int pageNumber = 0;
protected Vector pageList = new Vector();
protected List pageList = new java.util.Vector();
//protected ProgressListener progressListener = null; //protected ProgressListener progressListener = null;
protected Translator res = 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; protected Color saveColor = null;


/** /**

+ 48
- 5
src/org/apache/fop/render/awt/FontMetricsMapper.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.awt;


// Java // Java

+ 48
- 5
src/org/apache/fop/render/awt/FontSetup.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.awt;


// FOP // FOP

+ 69
- 38
src/org/apache/fop/render/pcl/PCLRenderer.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.pcl;


// FOP // FOP
import org.apache.fop.render.PrintRenderer; 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 // Java
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Enumeration;


/** /**
* Renderer that renders areas to PCL * Renderer that renders areas to PCL
/** /**
* the current stream to add PCL commands to * the current stream to add PCL commands to
*/ */
public PCLStream currentStream;
protected PCLStream currentStream;


private int pageHeight = 7920; private int pageHeight = 7920;


// These variables control the virtual paggination functionality. // These variables control the virtual paggination functionality.
public int curdiv = 0;
private int curdiv = 0;
private int divisions = -1; 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 int fullmargin = 0;
private final boolean debug = false; 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; private java.util.Hashtable options;


/** /**
* Create the PCL renderer * Create the PCL renderer
*/ */
public PCLRenderer() {}
public PCLRenderer() {
}


/** /**
* set the PCL document's producer * set the PCL document's producer
* *
* @param producer string indicating application producing PCL * @param producer string indicating application producing PCL
*/ */
public void setProducer(String producer) {}
public void setProducer(String producer) {
}


public void setFont(String name, float size) { public void setFont(String name, float size) {
int fontcode = 0; int fontcode = 0;


currentStream.add("\033(19M\033(s1p" + (size / 1000) currentStream.add("\033(19M\033(s1p" + (size / 1000)
+ "v0s0b16686T"); + "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; break;
case 14: // F14 = Zapf Dingbats case 14: // F14 = Zapf Dingbats


} }
} }


public void startRenderer(OutputStream outputStream)
throws IOException {
public void startRenderer(OutputStream outputStream) throws IOException {
getLogger().info("rendering areas to PCL"); getLogger().info("rendering areas to PCL");
currentStream = new PCLStream(outputStream); currentStream = new PCLStream(outputStream);


// Set orientation. // Set orientation.
if (orientation > -1)
if (orientation > -1) {
currentStream.add("\033&l" + orientation + "O"); currentStream.add("\033&l" + orientation + "O");
else
} else {
currentStream.add("\033&l0O"); currentStream.add("\033&l0O");
if (orientation == 1 || orientation == 3)
}
if (orientation == 1 || orientation == 3) {
xoffset = -144; xoffset = -144;
else
} else {
xoffset = -180; xoffset = -180;
}


// Reset the margins. // Reset the margins.
currentStream.add("\033" + "9\033&l0E"); currentStream.add("\033" + "9\033&l0E");
} }


public void stopRenderer()
throws IOException {
public void stopRenderer() throws IOException {
} }


} }

+ 57
- 10
src/org/apache/fop/render/pcl/PCLStream.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.pcl;


import java.io.*;
import java.io.IOException;
import java.io.OutputStream;


public class PCLStream { public class PCLStream {
OutputStream out = null;
boolean doOutput = true;
private OutputStream out = null;
private boolean doOutput = true;


public PCLStream(OutputStream os) { public PCLStream(OutputStream os) {
out = os; out = os;
} }


public void add(String str) { public void add(String str) {
if (!doOutput)
if (!doOutput) {
return; return;
}


byte buff[] = new byte[str.length()]; byte buff[] = new byte[str.length()];
int countr; int countr;
int len = str.length(); int len = str.length();
for (countr = 0; countr < len; countr++)
for (countr = 0; countr < len; countr++) {
buff[countr] = (byte)str.charAt(countr); buff[countr] = (byte)str.charAt(countr);
}
try { try {
out.write(buff); out.write(buff);
} catch (IOException e) { } catch (IOException e) {

+ 64
- 22
src/org/apache/fop/render/pdf/CTMHelper.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.pdf;


import org.apache.fop.area.CTM; import org.apache.fop.area.CTM;
* <p>Converts the sourceMatrix to a string for use in the PDFRender cm operations.</p> * <p>Converts the sourceMatrix to a string for use in the PDFRender cm operations.</p>
* <p>For example: * <p>For example:
* <pre> * <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); * String pdfMatrix = org.apache.fop.render.pdf.CTMHelper.toPDFString(ctm);
* </pre> * </pre>
* will return the string "<code>1.0 0.0 0.0 1.0 1.0 1.0</code>". * will return the string "<code>1.0 0.0 0.0 1.0 1.0 1.0</code>".
* @param sourceMatrix - The matrix to convert. * @param sourceMatrix - The matrix to convert.
* *
* @return a space seperated string containing the matrix elements. * @return a space seperated string containing the matrix elements.
*
* @throws IllegalArgumentException if the sourceMatrix parameter is null.
*/ */
public static String toPDFString(CTM sourceMatrix) { public static String toPDFString(CTM sourceMatrix) {
if (null == 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); 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>Creates a new CTM based in the sourceMatrix.</p>
* <p>For example: * <p>For example:
* <pre> * <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> * </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. * 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. * @param sourceMatrix - The matrix to convert.
* *
* @return a new converted matrix. * @return a new converted matrix.
*
* @throws IllegalArgumentException if the sourceMatrix parameter is null.
*/ */
public static CTM toPDFCTM(CTM sourceMatrix) { public static CTM toPDFCTM(CTM sourceMatrix) {
if (null == 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); final double matrix[] = toPDFArray(sourceMatrix);
* <p>Creates an array of six doubles from the source CTM.</p> * <p>Creates an array of six doubles from the source CTM.</p>
* <p>For example: * <p>For example:
* <pre> * <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); * double matrix[] = org.apache.fop.render.pdf.CTMHelper.toPDFArray(ctm);
* </pre> * </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. * matrix[4] == 1.0 and matrix[5] == 1.0.
* *
* @param sourceMatrix - The matrix to convert. * @param sourceMatrix - The matrix to convert.
*
* @return an array of doubles containing the converted matrix. * @return an array of doubles containing the converted matrix.
*
* @throws IllegalArgumentException if the sourceMatrix parameter is null.
*/ */
public static double[] toPDFArray(CTM sourceMatrix) { public static double[] toPDFArray(CTM sourceMatrix) {
if (null == 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(); final double matrix[] = sourceMatrix.toArray();

+ 48
- 5
src/org/apache/fop/render/pdf/EmbedFontInfo.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.pdf;


import java.util.List; import java.util.List;

+ 71
- 7
src/org/apache/fop/render/pdf/FontReader.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.pdf;


//Java //Java


/** /**
* Sets the path to embed a font. A null value disables font embedding. * 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) { public void setFontEmbedPath(String path) {
returnFont.setEmbedFileName(path); returnFont.setEmbedFileName(path);


/** /**
* Enable/disable use of kerning for the font * Enable/disable use of kerning for the font
* @param enabled true to enable kerning, false to disable
*/ */
public void setKerningEnabled(boolean enabled) { public void setKerningEnabled(boolean enabled) {
returnFont.setKerningEnabled(enabled); returnFont.setKerningEnabled(enabled);


/** /**
* Get the generated font object * Get the generated font object
* @return the font
*/ */
public Font getFont() { public Font getFont() {
return returnFont; return returnFont;
/** /**
* Construct a FontReader object from a path to a metric.xml file * Construct a FontReader object from a path to a metric.xml file
* and read metric data * 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 { public FontReader(String path) throws FOPException {
createFont(path); 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) { public void setDocumentLocator(Locator locator) {
this.locator = locator; this.locator = locator;
} }


/**
* @see org.xml.sax.ContentHandler#startElement(String, String, String, Attributes)
*/
public void startElement(String uri, String localName, String qName, public void startElement(String uri, String localName, String qName,
Attributes attributes) { Attributes attributes) {
if (localName.equals("font-metrics")) { if (localName.equals("font-metrics")) {
//singleFont.width = new int[256]; //singleFont.width = new int[256];
} else if ("char".equals(localName)) { } else if ("char".equals(localName)) {
try { try {
singleFont.setWidth( Integer.parseInt(attributes.getValue("idx")),
singleFont.setWidth(Integer.parseInt(attributes.getValue("idx")),
Integer.parseInt(attributes.getValue("wdt"))); Integer.parseInt(attributes.getValue("wdt")));
} catch (NumberFormatException ne) { } catch (NumberFormatException ne) {
System.out.println("Malformed width in metric file: " System.out.println("Malformed width in metric file: "
return ret; return ret;
} }


/**
* @see org.xml.sax.ContentHandler#endElement(String, String, String)
*/
public void endElement(String uri, String localName, String qName) { public void endElement(String uri, String localName, String qName) {
if ("font-name".equals(localName)) { if ("font-name".equals(localName)) {
returnFont.setFontName(text.toString()); returnFont.setFontName(text.toString());
text.setLength(0); //Reset text buffer (see characters()) 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) { public void characters(char[] ch, int start, int length) {
text.append(ch, start, length); text.append(ch, start, length);
} }

+ 48
- 5
src/org/apache/fop/render/pdf/FontSetup.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.pdf;


// FOP // FOP

+ 68
- 5
src/org/apache/fop/render/pdf/FontTriplet.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.pdf;


/** /**
* FontTriplet contains information on name, weight, style of one font * FontTriplet contains information on name, weight, style of one font
*/ */
public class FontTriplet { public class FontTriplet {
private String name, weight, style; 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) { public FontTriplet(String name, String weight, String style) {
this.name = name; this.name = name;
this.weight = weight; this.weight = weight;
this.style = style; this.style = style;
} }


/**
* Returns the font name.
* @return the font name
*/
public String getName() { public String getName() {
return name; return name;
} }


/**
* Returns the font weight.
* @return the font weight
*/
public String getWeight() { public String getWeight() {
return weight; return weight;
} }


/**
* Returns the font style.
* @return the font style
*/
public String getStyle() { public String getStyle() {
return style; return style;
} }

+ 133
- 32
src/org/apache/fop/render/pdf/FopPDFImage.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.pdf;


import org.apache.fop.pdf.PDFImage; import org.apache.fop.pdf.PDFImage;


import java.io.IOException; import java.io.IOException;
import java.awt.color.ColorSpace; import java.awt.color.ColorSpace;
import java.awt.color.ICC_ColorSpace;
import java.awt.color.ICC_Profile; import java.awt.color.ICC_Profile;
import java.util.Map; import java.util.Map;


/**
* PDFImage implementation for the PDF renderer.
*/
public class FopPDFImage implements PDFImage { 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); isPS = (fopImage instanceof EPSImage);
} }


// key to look up XObject
/**
* @see org.apache.fop.pdf.PDFImage#getKey()
*/
public String 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) { public void setup(PDFDocument doc) {
filters = doc.getFilterMap(); filters = doc.getFilterMap();
if ("image/jpeg".equals(fopImage.getMimeType())) { if ("image/jpeg".equals(fopImage.getMimeType())) {
} }
} }


/**
* @see org.apache.fop.pdf.PDFImage#isPS()
*/
public boolean isPS() { public boolean isPS() {
return isPS; return isPS;
} }


// image size
/**
* @see org.apache.fop.pdf.PDFImage#getWidth()
*/
public int getWidth() { public int getWidth() {
return fopImage.getWidth(); return fopImage.getWidth();
} }


/**
* @see org.apache.fop.pdf.PDFImage#getHeight()
*/
public int getHeight() { public int getHeight() {
return fopImage.getHeight(); return fopImage.getHeight();
} }


// DeviceGray, DeviceRGB, or DeviceCMYK
/**
* @see org.apache.fop.pdf.PDFImage#getColorSpace()
*/
public PDFColorSpace getColorSpace() { public PDFColorSpace getColorSpace() {
// DeviceGray, DeviceRGB, or DeviceCMYK
return toPDFColorSpace(fopImage.getColorSpace()); return toPDFColorSpace(fopImage.getColorSpace());
} }


/**
* @see org.apache.fop.pdf.PDFImage#getBitsPerPixel()
*/
public int getBitsPerPixel() { public int getBitsPerPixel() {
return fopImage.getBitsPerPixel(); return fopImage.getBitsPerPixel();
} }


// For transparent images
/**
* @see org.apache.fop.pdf.PDFImage#isTransparent()
*/
public boolean isTransparent() { public boolean isTransparent() {
return fopImage.isTransparent(); return fopImage.isTransparent();
} }


/**
* @see org.apache.fop.pdf.PDFImage#getTransparentColor()
*/
public PDFColor getTransparentColor() { public PDFColor getTransparentColor() {
return fopImage.getTransparentColor(); return fopImage.getTransparentColor();
} }


/**
* @see org.apache.fop.pdf.PDFImage#getMask()
*/
public String getMask() { public String getMask() {
return maskRef; return maskRef;
} }


/**
* @see org.apache.fop.pdf.PDFImage#getSoftMask()
*/
public String getSoftMask() { public String getSoftMask() {
return softMaskRef; return softMaskRef;
} }


/**
* @see org.apache.fop.pdf.PDFImage#getDataStream()
*/
public PDFStream getDataStream() throws IOException { public PDFStream getDataStream() throws IOException {
if(isPS) {
if (isPS) {
return getPSDataStream(); return getPSDataStream();
} else { } else {
// delegate the stream work to PDFStream // delegate the stream work to PDFStream
} }
} }


/**
* 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 { protected PDFStream getPSDataStream() throws IOException {
int length = 0; int length = 0;
int i = 0; int i = 0;
preamble.append("/showpage {} def\n"); 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]) + " 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"); preamble.append("newpath\n");


StringBuffer post = new StringBuffer(); StringBuffer post = new StringBuffer();
byte[] postBytes = post.toString().getBytes(); byte[] postBytes = post.toString().getBytes();
byte[] epsBytes = ((EPSImage)fopImage).getEPSImage(); byte[] epsBytes = ((EPSImage)fopImage).getEPSImage();
int epsLength = epsBytes.length; 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 (preBytes, 0, imgData, 0, preBytes.length);
System.arraycopy (epsBytes, 0, imgData, System.arraycopy (epsBytes, 0, imgData,
return imgStream; return imgStream;
} }


/**
* @see org.apache.fop.pdf.PDFImage#getICCStream()
*/
public PDFICCStream getICCStream() { public PDFICCStream getICCStream() {
return pdfICCStream; 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); PDFColorSpace pdfCS = new PDFColorSpace(0);
switch(cs.getType()) { switch(cs.getType()) {

+ 48
- 5
src/org/apache/fop/render/pdf/PDFXMLHandler.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.pdf;


import org.apache.fop.render.XMLHandler; import org.apache.fop.render.XMLHandler;

+ 48
- 4
src/org/apache/fop/render/ps/ASCII85OutputStream.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.ps;


import java.io.OutputStream; import java.io.OutputStream;

+ 48
- 4
src/org/apache/fop/render/ps/ASCIIHexOutputStream.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.ps;


import java.io.OutputStream; import java.io.OutputStream;

+ 48
- 4
src/org/apache/fop/render/ps/DSCConstants.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.ps;


/** /**

+ 48
- 4
src/org/apache/fop/render/ps/Finalizable.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.ps;


/** /**

+ 48
- 4
src/org/apache/fop/render/ps/FlateEncodeOutputStream.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.ps;


import java.io.OutputStream; import java.io.OutputStream;

+ 48
- 4
src/org/apache/fop/render/ps/PSGenerator.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.ps;


import java.io.OutputStream; import java.io.OutputStream;

+ 48
- 5
src/org/apache/fop/render/ps/PSGraphics2D.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.ps;


//Java //Java

+ 48
- 4
src/org/apache/fop/render/ps/PSProcSets.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.ps;


import java.io.IOException; import java.io.IOException;

+ 48
- 5
src/org/apache/fop/render/ps/PSState.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.ps;


import java.io.Serializable; import java.io.Serializable;

+ 48
- 5
src/org/apache/fop/render/ps/PSTextElementBridge.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.ps;


//import org.apache.batik.gvt.TextNode; //import org.apache.batik.gvt.TextNode;

+ 48
- 5
src/org/apache/fop/render/ps/PSXMLHandler.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.ps;


import org.apache.fop.render.XMLHandler; import org.apache.fop.render.XMLHandler;

+ 48
- 4
src/org/apache/fop/render/ps/RunLengthEncodeOutputStream.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.ps;


import java.io.FilterOutputStream; import java.io.FilterOutputStream;

+ 175
- 86
src/org/apache/fop/render/svg/SVGRenderer.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.svg;


import org.apache.fop.apps.FOPException; 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.svg.SVGUtilities;
import org.apache.fop.layout.FontInfo; import org.apache.fop.layout.FontInfo;
import org.apache.fop.fo.FOUserAgent; import org.apache.fop.fo.FOUserAgent;
import org.apache.fop.fo.properties.RuleStyle; import org.apache.fop.fo.properties.RuleStyle;


import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.ProcessingInstruction;
import org.w3c.dom.svg.SVGSVGElement; import org.w3c.dom.svg.SVGSVGElement;
import org.w3c.dom.svg.SVGDocument; import org.w3c.dom.svg.SVGDocument;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Text; import org.w3c.dom.Text;


import org.apache.batik.dom.svg.SVGDOMImplementation; 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.dom.util.XMLSupport;
import org.apache.batik.transcoder.svg2svg.SVGTranscoder; import org.apache.batik.transcoder.svg2svg.SVGTranscoder;
import org.apache.batik.transcoder.TranscoderInput; import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.dom.util.DOMUtilities; import org.apache.batik.dom.util.DOMUtilities;


import java.awt.Color; import java.awt.Color;
import java.awt.Image;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
import java.util.HashMap; import java.util.HashMap;
import java.net.URL;
import java.net.MalformedURLException;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import javax.swing.ImageIcon;


import org.apache.fop.render.AbstractRenderer; import org.apache.fop.render.AbstractRenderer;
import org.apache.fop.render.XMLHandler; import org.apache.fop.render.XMLHandler;
import org.apache.fop.render.RendererContext; import org.apache.fop.render.RendererContext;


/**
* This is the SVG renderer.
*/
public class SVGRenderer extends AbstractRenderer implements XMLHandler { 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 // 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 * The current (internal) font name
*/ */
protected String currentFontName;
private String currentFontName;


/** /**
* The current font size in millipoints * The current font size in millipoints
*/ */
protected int currentFontSize;
private int currentFontSize;


/** /**
* The current colour's red, green and blue component * 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() { 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) { public void setUserAgent(FOUserAgent agent) {
super.setUserAgent(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) { public void setupFontInfo(FontInfo fontInfo) {
// create a temp Image to test font metrics on // create a temp Image to test font metrics on
BufferedImage fontImage = BufferedImage fontImage =
fontImage.createGraphics()); fontImage.createGraphics());
} }


/**
* @see org.apache.fop.render.Renderer#setProducer(String)
*/
public void setProducer(String producer) { public void setProducer(String producer) {
} }


/**
* @see org.apache.fop.render.Renderer#startRenderer(OutputStream)
*/
public void startRenderer(OutputStream outputStream) public void startRenderer(OutputStream outputStream)
throws IOException {
throws IOException {
ostream = outputStream; 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(); svgRoot = svgDocument.getDocumentElement();
/*
ProcessingInstruction pi =
svgDocument.createProcessingInstruction("xml",
" version=\"1.0\" encoding=\"ISO-8859-1\"");
svgDocument.insertBefore(pi, svgRoot); svgDocument.insertBefore(pi, svgRoot);
*/


docDefs = svgDocument.createElementNS(svgNS, "defs");
docDefs = svgDocument.createElementNS(SVG_NAMESPACE, "defs");
svgRoot.appendChild(docDefs); 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); pagesGroup.appendChild(pageDefs);
svgRoot.appendChild(pagesGroup); svgRoot.appendChild(pagesGroup);


} }


/** /**
*
* @see org.apache.fop.render.Renderer#stopRenderer()
*/ */
public void stopRenderer() throws IOException { public void stopRenderer() throws IOException {
totalWidth += sequenceWidth; totalWidth += sequenceWidth;
pageNumber = 0; pageNumber = 0;
} }


/**
* @see org.apache.fop.render.Renderer#startPageSequence(Title)
*/
public void startPageSequence(Title seqTitle) { public void startPageSequence(Title seqTitle) {
totalWidth += sequenceWidth; totalWidth += sequenceWidth;
if (sequenceHeight > totalHeight) { if (sequenceHeight > totalHeight) {
// convert first title to a string and set for svg document title // convert first title to a string and set for svg document title
docTitle = seqTitle; docTitle = seqTitle;
String str = convertTitleToString(seqTitle); String str = convertTitleToString(seqTitle);
Element svgTitle = svgDocument.createElementNS(svgNS, "title");
Element svgTitle = svgDocument.createElementNS(SVG_NAMESPACE, "title");
Text strNode = svgDocument.createTextNode(str); Text strNode = svgDocument.createTextNode(str);
svgTitle.appendChild(strNode); svgTitle.appendChild(strNode);
svgRoot.insertBefore(svgTitle, svgRoot.getFirstChild()); 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 lastWidth = pageWidth;
float lastHeight = pageHeight; float lastHeight = pageHeight;




// if there is a link from the last page // if there is a link from the last page
if (lastLink != null) { 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); pagesGroup.appendChild(lastLink);
} }


currentPageG = svgDocument.createElementNS(svgNS, "svg");
currentPageG = svgDocument.createElementNS(SVG_NAMESPACE, "svg");
currentPageG.setAttributeNS(null, "viewbox", currentPageG.setAttributeNS(null, "viewbox",
"0 0 " + (int) pageWidth + " " + (int) pageHeight); "0 0 " + (int) pageWidth + " " + (int) pageHeight);
currentPageG.setAttributeNS(null, "width", currentPageG.setAttributeNS(null, "width",
// render the page contents // render the page contents
super.renderPage(page); 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, "xlink:href", "#Page-" + pageNumber);
use.setAttributeNS(null, "x", "" + totalWidth); use.setAttributeNS(null, "x", "" + totalWidth);
use.setAttributeNS(null, "y", "" + (sequenceHeight - pageHeight)); use.setAttributeNS(null, "y", "" + (sequenceHeight - pageHeight));
pagesGroup.appendChild(use); pagesGroup.appendChild(use);


Element lastPageLink = svgDocument.createElementNS(svgNS, "a");
Element lastPageLink = svgDocument.createElementNS(SVG_NAMESPACE, "a");
if (lastLink != null) { if (lastLink != null) {
lastPageLink.setAttributeNS(null, "xlink:href", lastViewbox); lastPageLink.setAttributeNS(null, "xlink:href", lastViewbox);
} else { } else {
lastPageLink.setAttributeNS(null, "xlink:href", lastPageLink.setAttributeNS(null, "xlink:href",
"#svgView(viewBox(" + totalWidth + ", " +
(sequenceHeight - pageHeight) + ", " + pageWidth +
", " + pageHeight + "))");
"#svgView(viewBox("
+ totalWidth + ", "
+ (sequenceHeight - pageHeight) + ", "
+ pageWidth + ", "
+ pageHeight + "))");
} }
pagesGroup.appendChild(lastPageLink); pagesGroup.appendChild(lastPageLink);


// setup a link to the next page, only added when the // setup a link to the next page, only added when the
// next page is rendered // next page is rendered
Element rect = SVGUtilities.createRect(svgDocument, totalWidth, Element rect = SVGUtilities.createRect(svgDocument, totalWidth,
(sequenceHeight - pageHeight), pageWidth / 2, pageHeight);
(sequenceHeight - pageHeight), pageWidth / 2, pageHeight);
rect.setAttributeNS(null, "style", "fill:blue;visibility:hidden"); rect.setAttributeNS(null, "style", "fill:blue;visibility:hidden");
lastPageLink.appendChild(rect); lastPageLink.appendChild(rect);


lastLink = svgDocument.createElementNS(svgNS, "a");
lastLink = svgDocument.createElementNS(SVG_NAMESPACE, "a");
rect = SVGUtilities.createRect(svgDocument, rect = SVGUtilities.createRect(svgDocument,
totalWidth + pageWidth / 2, totalWidth + pageWidth / 2,
(sequenceHeight - pageHeight), pageWidth / 2, pageHeight); (sequenceHeight - pageHeight), pageWidth / 2, pageHeight);
rect.setAttributeNS(null, "style", "fill:blue;visibility:hidden"); rect.setAttributeNS(null, "style", "fill:blue;visibility:hidden");
lastLink.appendChild(rect); lastLink.appendChild(rect);


lastViewbox = "#svgView(viewBox(" + totalWidth + ", " +
(sequenceHeight - pageHeight) + ", " + pageWidth +
", " + pageHeight + "))";
lastViewbox = "#svgView(viewBox("
+ totalWidth + ", "
+ (sequenceHeight - pageHeight) + ", "
+ pageWidth + ", "
+ pageHeight + "))";


pageNumber++; pageNumber++;


} }


/**
* Method renderForeignObject.
* @param fo the foreign object
*/
public void renderForeignObject(ForeignObject fo) { public void renderForeignObject(ForeignObject fo) {
Document doc = fo.getDocument(); Document doc = fo.getDocument();
String ns = fo.getNameSpace(); String ns = fo.getNameSpace();
userAgent.renderXML(context, doc, ns); userAgent.renderXML(context, doc, ns);
} }


/**
* @see org.apache.fop.render.XMLHandler#handleXML(RendererContext, Document, String)
*/
public void handleXML(RendererContext context, Document doc, public void handleXML(RendererContext context, Document doc,
String ns) throws Exception { String ns) throws Exception {
if (svgNS.equals(ns)) {
if (SVG_NAMESPACE.equals(ns)) {
if (!(doc instanceof SVGDocument)) { if (!(doc instanceof SVGDocument)) {
DOMImplementation impl = DOMImplementation impl =
SVGDOMImplementation.getDOMImplementation(); SVGDOMImplementation.getDOMImplementation();
doc = DOMUtilities.deepCloneDocument(doc, impl); doc = DOMUtilities.deepCloneDocument(doc, impl);
} }
SVGSVGElement svg = ((SVGDocument) doc).getRootElement(); SVGSVGElement svg = ((SVGDocument) doc).getRootElement();
Element view = svgDocument.createElementNS(svgNS, "svg");
Element view = svgDocument.createElementNS(SVG_NAMESPACE, "svg");
Node newsvg = svgDocument.importNode(svg, true); Node newsvg = svgDocument.importNode(svg, true);
//view.setAttributeNS(null, "viewBox", "0 0 "); //view.setAttributeNS(null, "viewBox", "0 0 ");
view.setAttributeNS(null, "x", view.setAttributeNS(null, "x",
// this fixes a problem where the xmlns is repeated sometimes // this fixes a problem where the xmlns is repeated sometimes
Element ele = (Element) newsvg; Element ele = (Element) newsvg;
ele.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns", ele.setAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns",
svgNS);
SVG_NAMESPACE);
if (ele.hasAttributeNS(null, "xmlns")) { if (ele.hasAttributeNS(null, "xmlns")) {
ele.removeAttributeNS(null, "xmlns"); ele.removeAttributeNS(null, "xmlns");
} }
} }
} }


/**
* @see org.apache.fop.render.Renderer#renderLeader(Leader)
*/
public void renderLeader(Leader area) { 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()) { switch (area.getRuleStyle()) {
case RuleStyle.DOTTED: case RuleStyle.DOTTED:
style += "stroke-dasharray:1,1"; style += "stroke-dasharray:1,1";
break; break;
} }
Element line = SVGUtilities.createLine(svgDocument, 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); line.setAttributeNS(null, "style", style);
currentPageG.appendChild(line); currentPageG.appendChild(line);


super.renderLeader(area); super.renderLeader(area);
} }


/**
* @see org.apache.fop.render.Renderer#renderWord(Word)
*/
public void renderWord(Word word) { public void renderWord(Word word) {
Element text = SVGUtilities.createText(svgDocument, Element text = SVGUtilities.createText(svgDocument,
currentBlockIPPosition / 1000, currentBlockIPPosition / 1000,
super.renderWord(word); super.renderWord(word);
} }


/**
* @see org.apache.fop.render.Renderer#renderCharacter(Character)
*/
public void renderCharacter(org.apache.fop.area.inline.Character ch) { public void renderCharacter(org.apache.fop.area.inline.Character ch) {
Element text = SVGUtilities.createText(svgDocument, Element text = SVGUtilities.createText(svgDocument,
currentBlockIPPosition / 1000, currentBlockIPPosition / 1000,

+ 108
- 63
src/org/apache/fop/render/txt/TXTRenderer.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.txt;


// FOP // FOP
import org.apache.fop.render.PrintRenderer; 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 * 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 * Modified by Mark Lillywhite mark-fop@inomial.com to use the new
* Renderer interface. * Renderer interface.
*/ */
/** /**
* the current stream to add Text commands to * the current stream to add Text commands to
*/ */
PCLStream currentStream;
private PCLStream currentStream;


private int pageHeight = 7920; private int pageHeight = 7920;


// These variables control the virtual paggination functionality. // These variables control the virtual paggination functionality.
public int curdiv = 0;
private int curdiv = 0;
private int divisions = -1; private int divisions = -1;
private int paperheight = -1; // Paper height in decipoints? 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; private int fullmargin = 0;
final boolean debug = false;
private final boolean debug = false;


// Variables for rendering text. // 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 * @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 getLogger().debug("TXTRenderer.addStr(" + row + ", " + col
+ ", \"" + str + "\", " + ischar + ")"); + ", \"" + str + "\", " + ischar + ")");
if (suppressGraphics &&!ischar)
}
if (suppressGraphics && !ischar) {
return; return;
}
StringBuffer sb; StringBuffer sb;
if (row < 0)
if (row < 0) {
row = 0; row = 0;
if (ischar)
}
if (ischar) {
sb = charData[row]; sb = charData[row];
else
} else {
sb = decoData[row]; sb = decoData[row];
if (sb == null)
}
if (sb == null) {
sb = new StringBuffer(); sb = new StringBuffer();
if ((col + str.length()) > maxX)
}
if ((col + str.length()) > maxX) {
col = maxX - str.length(); col = maxX - str.length();
}
if (col < 0) { if (col < 0) {
col = 0; col = 0;
if (str.length() > maxX)
if (str.length() > maxX) {
str = str.substring(0, maxX); str = str.substring(0, maxX);
}
} }
// Pad to col // Pad to col
for (int countr = sb.length(); countr < col; countr++)
for (int countr = sb.length(); countr < col; countr++) {
sb.append(' '); sb.append(' ');
if (debug)
}
if (debug) {
getLogger().debug("TXTRenderer.addStr() sb.length()=" getLogger().debug("TXTRenderer.addStr() sb.length()="
+ sb.length()); + sb.length());
}
for (int countr = col; countr < (col + str.length()); countr++) { for (int countr = col; countr < (col + str.length()); countr++) {
if (countr >= sb.length())
if (countr >= sb.length()) {
sb.append(str.charAt(countr - col)); sb.append(str.charAt(countr - col));
else {
if (debug)
} else {
if (debug) {
getLogger().debug("TXTRenderer.addStr() sb.length()=" getLogger().debug("TXTRenderer.addStr() sb.length()="
+ sb.length() + " countr=" + countr); + sb.length() + " countr=" + countr);
}
sb.setCharAt(countr, str.charAt(countr - col)); sb.setCharAt(countr, str.charAt(countr - col));
} }
} }


if (ischar)
if (ischar) {
charData[row] = sb; charData[row] = sb;
else
} else {
decoData[row] = sb; decoData[row] = sb;
}
} }


} }

+ 70
- 9
src/org/apache/fop/render/txt/TXTStream.java View File

/* /*
* $Id$ * $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; 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 { 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) { public TXTStream(OutputStream os) {
out = os; out = os;
} }


/**
* Adds a String to the OutputStream
* @param str String to add
*/
public void add(String str) { public void add(String str) {
if (!doOutput)
if (!doOutput) {
return; return;
}


try { try {
byte buff[] = str.getBytes("UTF-8"); byte buff[] = str.getBytes("UTF-8");
} }
} }


/**
* Controls whether output is actually written.
* @param doout true to enable output, false to suppress
*/
public void setDoOutput(boolean doout) { public void setDoOutput(boolean doout) {
doOutput = doout; doOutput = doout;
} }

+ 189
- 58
src/org/apache/fop/render/xml/XMLRenderer.java View File

/* /*
* $Id$ * $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; 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 // Java
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Iterator; import java.util.Iterator;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;


// XML
import org.w3c.dom.Document; 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. * Renderer that renders areas to XML for debugging purposes.
* This creates an xml that contains the information of the area * This creates an xml that contains the information of the area
* which can be rendered to any renderer. * which can be rendered to any renderer.
*/ */
public class XMLRenderer extends AbstractRenderer { 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) { public void setProducer(String producer) {
} }


*/ */
private boolean consistentOutput = false; private boolean consistentOutput = false;


/**
* Creates a new XML renderer.
*/
public XMLRenderer() { 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) { public void setUserAgent(FOUserAgent agent) {
super.setUserAgent(agent); super.setUserAgent(agent);


// //
//userAgent.addExtensionHandler(); //userAgent.addExtensionHandler();
XMLHandler handler = new XMLXMLHandler(); XMLHandler handler = new XMLXMLHandler();
userAgent.setDefaultXMLHandler(mimeType, handler);
userAgent.setDefaultXMLHandler(XML_MIME_TYPE, handler);
String svg = "http://www.w3.org/2000/svg"; String svg = "http://www.w3.org/2000/svg";
userAgent.addXMLHandler(mimeType, svg, handler);
userAgent.addXMLHandler(XML_MIME_TYPE, svg, handler);
} }


/** /**
} }


/** /**
* @see org.apache.fop.render.Renderer#startRenderer(OutputStream)
*/ */
public void startRenderer(OutputStream outputStream) public void startRenderer(OutputStream outputStream)
throws IOException {
throws IOException {
getLogger().debug("rendering areas to XML"); getLogger().debug("rendering areas to XML");
this.writer = new PrintWriter(outputStream); 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>"); writeStartTag("<areaTree>");
} }


/** /**
* @see org.apache.fop.render.Renderer#stopRenderer()
*/ */
public void stopRenderer() throws IOException { public void stopRenderer() throws IOException {
writeEndTag("</pageSequence>"); writeEndTag("</pageSequence>");
getLogger().debug("written out XML"); 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>"); writeStartTag("<page>");
super.renderPage(page); super.renderPage(page);
writeEndTag("</page>"); writeEndTag("</page>");
} }


private String createString(Rectangle2D rect) { 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) { public void startPageSequence(Title seqTitle) {
if (startedSequence) { if (startedSequence) {
writeEndTag("</pageSequence>"); writeEndTag("</pageSequence>");
} }
} }


/**
* @see org.apache.fop.render.AbstractRenderer#renderRegionViewport(RegionViewport)
*/
protected void renderRegionViewport(RegionViewport port) { protected void renderRegionViewport(RegionViewport port) {
if (port != null) { if (port != null) {
writeStartTag("<regionViewport rect=\"" +
createString(port.getViewArea()) + "\">");
writeStartTag("<regionViewport rect=\""
+ createString(port.getViewArea()) + "\">");
RegionReference region = port.getRegion(); RegionReference region = port.getRegion();
if (region.getRegionClass() == RegionReference.BEFORE) { if (region.getRegionClass() == RegionReference.BEFORE) {
writeStartTag("<regionBefore>"); writeStartTag("<regionBefore>");
} }
} }


/**
* @see org.apache.fop.render.AbstractRenderer#renderBeforeFloat(BeforeFloat)
*/
protected void renderBeforeFloat(BeforeFloat bf) { protected void renderBeforeFloat(BeforeFloat bf) {
writeStartTag("<beforeFloat>"); writeStartTag("<beforeFloat>");
super.renderBeforeFloat(bf); super.renderBeforeFloat(bf);
writeEndTag("</beforeFloat>"); writeEndTag("</beforeFloat>");
} }


/**
* @see org.apache.fop.render.AbstractRenderer#renderFootnote(Footnote)
*/
protected void renderFootnote(Footnote footnote) { protected void renderFootnote(Footnote footnote) {
writeStartTag("<footnote>"); writeStartTag("<footnote>");
super.renderFootnote(footnote); super.renderFootnote(footnote);
writeEndTag("</footnote>"); writeEndTag("</footnote>");
} }


/**
* @see org.apache.fop.render.AbstractRenderer#renderMainReference(MainReference)
*/
protected void renderMainReference(MainReference mr) { protected void renderMainReference(MainReference mr) {
writeStartTag("<mainReference columnGap=\"" +
mr.getColumnGap() + "\" width=\"" + mr.getWidth() + "\">");
writeStartTag("<mainReference columnGap=\""
+ mr.getColumnGap() + "\" width=\"" + mr.getWidth() + "\">");


Span span = null; Span span = null;
List spans = mr.getSpans(); List spans = mr.getSpans();
writeEndTag("</mainReference>"); writeEndTag("</mainReference>");
} }


// the normal flow reference area contains stacked blocks
/**
* @see org.apache.fop.render.AbstractRenderer#renderFlow(Flow)
*/
protected void renderFlow(Flow flow) { protected void renderFlow(Flow flow) {
// the normal flow reference area contains stacked blocks
writeStartTag("<flow>"); writeStartTag("<flow>");
super.renderFlow(flow); super.renderFlow(flow);
writeEndTag("</flow>"); writeEndTag("</flow>");
} }


/**
* @see org.apache.fop.render.AbstractRenderer#renderBlock(Block)
*/
protected void renderBlock(Block block) { protected void renderBlock(Block block) {
String prop = ""; String prop = "";
Map map = block.getTraits(); Map map = block.getTraits();
writeEndTag("</block>"); writeEndTag("</block>");
} }


/**
* @see org.apache.fop.render.AbstractRenderer#renderLineArea(LineArea)
*/
protected void renderLineArea(LineArea line) { protected void renderLineArea(LineArea line) {
String prop = ""; String prop = "";
Map map = line.getTraits(); Map map = line.getTraits();
if (map != null) { if (map != null) {
prop = " props=\"" + getPropString(map) + "\""; prop = " props=\"" + getPropString(map) + "\"";
} }
writeStartTag("<lineArea height=\"" + line.getHeight() + "\"" +
prop + ">");
writeStartTag("<lineArea height=\"" + line.getHeight() + "\""
+ prop + ">");
super.renderLineArea(line); super.renderLineArea(line);
writeEndTag("</lineArea>"); writeEndTag("</lineArea>");
} }


/**
* @see org.apache.fop.render.Renderer#renderViewport(Viewport)
*/
public void renderViewport(Viewport viewport) { public void renderViewport(Viewport viewport) {
writeStartTag("<viewport>"); writeStartTag("<viewport>");
super.renderViewport(viewport); super.renderViewport(viewport);
writeEndTag("</viewport>"); writeEndTag("</viewport>");
} }


/**
* Renders an image
* @param image the image
*/
public void renderImage(Image image) { public void renderImage(Image image) {
writeElement("<image url=\"" + image.getURL() + "\"/>"); writeElement("<image url=\"" + image.getURL() + "\"/>");
} }


/**
* @see org.apache.fop.render.Renderer#renderContainer(Container)
*/
public void renderContainer(Container cont) { public void renderContainer(Container cont) {
writeStartTag("<container>"); writeStartTag("<container>");


writeEndTag("</container>"); writeEndTag("</container>");
} }


/**
* Renders an fo:foreing-object.
* @param fo the foreign object
*/
public void renderForeignObject(ForeignObject fo) { public void renderForeignObject(ForeignObject fo) {
writeStartTag("<foreignObject>"); writeStartTag("<foreignObject>");
Document doc = fo.getDocument(); Document doc = fo.getDocument();
writeEndTag("</foreignObject>"); writeEndTag("</foreignObject>");
} }


/**
* @see org.apache.fop.render.Renderer#renderCharacter(Character)
*/
public void renderCharacter(org.apache.fop.area.inline.Character ch) { public void renderCharacter(org.apache.fop.area.inline.Character ch) {
String prop = ""; String prop = "";
Map map = ch.getTraits(); Map map = ch.getTraits();
writeElement("<char" + prop + ">" + ch.getChar() + "</char>"); writeElement("<char" + prop + ">" + ch.getChar() + "</char>");
} }


/**
* @see org.apache.fop.render.Renderer#renderInlineSpace(Space)
*/
public void renderInlineSpace(Space space) { public void renderInlineSpace(Space space) {
writeElement("<space width=\"" + space.getWidth() + "\"/>"); writeElement("<space width=\"" + space.getWidth() + "\"/>");
} }


/**
* @see org.apache.fop.render.Renderer#renderWord(Word)
*/
public void renderWord(Word word) { public void renderWord(Word word) {
String prop = ""; String prop = "";
Map map = word.getTraits(); Map map = word.getTraits();
if (map != null) { if (map != null) {
prop = " props=\"" + getPropString(map) + "\""; 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); super.renderWord(word);
} }


/**
* @see org.apache.fop.render.Renderer#renderInlineParent(InlineParent)
*/
public void renderInlineParent(InlineParent ip) { public void renderInlineParent(InlineParent ip) {
String prop = ""; String prop = "";
Map map = ip.getTraits(); Map map = ip.getTraits();
writeEndTag("</inlineparent>"); writeEndTag("</inlineparent>");
} }


/**
* @see org.apache.fop.render.Renderer#renderLeader(Leader)
*/
public void renderLeader(Leader area) { public void renderLeader(Leader area) {
String style = "solid"; String style = "solid";
switch (area.getRuleStyle()) { switch (area.getRuleStyle()) {
style = "ridge"; style = "ridge";
break; break;
} }
writeElement("<leader width=\"" + area.getWidth() + "\" ruleStyle=\"" + style +
"\" ruleThickness=\"" + area.getRuleThickness() + "\"/>");
writeElement("<leader width=\"" + area.getWidth()
+ "\" ruleStyle=\"" + style
+ "\" ruleThickness=\"" + area.getRuleThickness()
+ "\"/>");
super.renderLeader(area); 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) { protected String getPropString(Map traitMap) {
StringBuffer strbuf = new StringBuffer(); 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(); 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();
} }


} }

+ 99
- 45
src/org/apache/fop/render/xml/XMLXMLHandler.java View File

/* /*
* $Id$ * $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; package org.apache.fop.render.xml;


import org.apache.fop.fo.FOUserAgent;
import org.apache.fop.render.XMLHandler; import org.apache.fop.render.XMLHandler;
import org.apache.fop.render.RendererContext; import org.apache.fop.render.RendererContext;


import java.io.IOException; import java.io.IOException;


/** /**
* XML handler for the XML renderer.
*/ */
public class XMLXMLHandler implements XMLHandler { 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, public void handleXML(RendererContext context, Document doc,
String ns) throws Exception { String ns) throws Exception {
Writer writer = (Writer) context.getProperty(WRITER); Writer writer = (Writer) context.getProperty(WRITER);


/** /**
* Writes the given document using the given 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, public static void writeDocument(Document doc,
Writer w) throws IOException {
Writer writer) throws IOException {
for (Node n = doc.getFirstChild(); n != null; for (Node n = doc.getFirstChild(); n != null;
n = n.getNextSibling()) { n = n.getNextSibling()) {
writeNode(n, w);
writeNode(n, writer);
} }
} }


/** /**
* Writes a node using the given 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: 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(); int len = attr.getLength();
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
Attr a = (Attr) attr.item(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) { if (c != null) {
w.write(">");
writer.write(">");
for (; c != null; c = c.getNextSibling()) { 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 { } else {
w.write("/>");
writer.write("/>");
} }
break; break;
case Node.TEXT_NODE: case Node.TEXT_NODE:
w.write(contentToString(n.getNodeValue()));
writer.write(contentToString(node.getNodeValue()));
break; break;
case Node.CDATA_SECTION_NODE: case Node.CDATA_SECTION_NODE:
w.write("<![CDATA[");
w.write(n.getNodeValue());
w.write("]]>");
writer.write("<![CDATA[");
writer.write(node.getNodeValue());
writer.write("]]>");
break; break;
case Node.ENTITY_REFERENCE_NODE: case Node.ENTITY_REFERENCE_NODE:
w.write("&");
w.write(n.getNodeName());
w.write(";");
writer.write("&");
writer.write(node.getNodeName());
writer.write(";");
break; break;
case Node.PROCESSING_INSTRUCTION_NODE: 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; break;
case Node.COMMENT_NODE: case Node.COMMENT_NODE:
w.write("<!--");
w.write(n.getNodeValue());
w.write("-->");
writer.write("<!--");
writer.write(node.getNodeValue());
writer.write("-->");
break; break;
case Node.DOCUMENT_TYPE_NODE: case Node.DOCUMENT_TYPE_NODE:
break; break;
default: 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 * Returns the given content value transformed to replace invalid
* characters with entities. * characters with entities.
* @param s content value
* @return encoded value
*/ */
public static String contentToString(String s) { public static String contentToString(String s) {
StringBuffer result = new StringBuffer(); StringBuffer result = new StringBuffer();

+ 123
- 41
src/org/apache/fop/rtf/renderer/RTFHandler.java View File

/* /*
* $Id$ * $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; 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.apps.StructureHandler;
import org.apache.fop.layout.FontInfo; import org.apache.fop.layout.FontInfo;
import org.apache.fop.apps.FOPException; import org.apache.fop.apps.FOPException;


import org.apache.fop.fo.pagination.PageSequence; import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.fo.pagination.LayoutMasterSet; 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.Title;
import org.apache.fop.fo.flow.Block; import org.apache.fop.fo.flow.Block;
import org.apache.fop.fo.flow.Flow; import org.apache.fop.fo.flow.Flow;


// JFOR
import org.jfor.jfor.rtflib.rtfdoc.RtfFile; import org.jfor.jfor.rtflib.rtfdoc.RtfFile;
import org.jfor.jfor.rtflib.rtfdoc.RtfSection; import org.jfor.jfor.rtflib.rtfdoc.RtfSection;
import org.jfor.jfor.rtflib.rtfdoc.RtfParagraph; import org.jfor.jfor.rtflib.rtfdoc.RtfParagraph;
import org.jfor.jfor.rtflib.rtfdoc.RtfDocumentArea; 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 * RTF Handler: generates RTF output using the structure events from
* the FO Tree sent to this structure handler. * 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) { public RTFHandler(OutputStream os) {
_os = os;
this.os = os;
// use pdf fonts for now, this is only for resolving names // 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); System.err.println(ALPHA_WARNING);
} }


/**
* @see org.apache.fop.apps.StructureHandler#getFontInfo()
*/
public FontInfo getFontInfo() { public FontInfo getFontInfo() {
return _fontInfo;
return this.fontInfo;
} }


/**
* @see org.apache.fop.apps.StructureHandler#startDocument()
*/
public void startDocument() throws SAXException { public void startDocument() throws SAXException {
// FIXME sections should be created // FIXME sections should be created
try { 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? // FIXME could we throw Exception in all StructureHandler events?
throw new SAXException("IOException: " + ioe); throw new SAXException("IOException: " + ioe);
} }
} }


/**
* @see org.apache.fop.apps.StructureHandler#endDocument()
*/
public void endDocument() throws SAXException { public void endDocument() throws SAXException {
try { try {
_rtfFile.flush();
} catch(IOException ioe) {
rtfFile.flush();
} catch (IOException ioe) {
// FIXME could we throw Exception in all StructureHandler events? // FIXME could we throw Exception in all StructureHandler events?
throw new SAXException("IOException: " + ioe); throw new SAXException("IOException: " + ioe);
} }
} }


/**
* @see org.apache.fop.apps.StructureHandler
*/
public void startPageSequence(PageSequence pageSeq, Title seqTitle, LayoutMasterSet lms) { public void startPageSequence(PageSequence pageSeq, Title seqTitle, LayoutMasterSet lms) {
try { 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? // FIXME could we throw Exception in all StructureHandler events?
throw new Error("IOException: " + ioe); throw new Error("IOException: " + ioe);
} }
} }


/**
* @see org.apache.fop.apps.StructureHandler#endPageSequence(PageSequence)
*/
public void endPageSequence(PageSequence pageSeq) throws FOPException { public void endPageSequence(PageSequence pageSeq) throws FOPException {
} }


/**
* @see org.apache.fop.apps.StructureHandler#startFlow(Flow)
*/
public void startFlow(Flow fl) { public void startFlow(Flow fl) {
} }


/**
* @see org.apache.fop.apps.StructureHandler#endFlow(Flow)
*/
public void endFlow(Flow fl) { public void endFlow(Flow fl) {
} }


/**
* @see org.apache.fop.apps.StructureHandler#startBlock(Block)
*/
public void startBlock(Block bl) { public void startBlock(Block bl) {
try { try {
_para = _sect.newParagraph();
} catch(IOException ioe) {
para = sect.newParagraph();
} catch (IOException ioe) {
// FIXME could we throw Exception in all StructureHandler events? // FIXME could we throw Exception in all StructureHandler events?
throw new Error("IOException: " + ioe); throw new Error("IOException: " + ioe);
} }
} }


/**
* @see org.apache.fop.apps.StructureHandler#endBlock(Block)
*/
public void endBlock(Block bl) { public void endBlock(Block bl) {
} }


/**
* @see org.apache.fop.apps.StructureHandler#characters(char[], int, int)
*/
public void characters(char data[], int start, int length) { public void characters(char data[], int start, int length) {
try { 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? // FIXME could we throw Exception in all StructureHandler events?
throw new Error("IOException: " + ioe); throw new Error("IOException: " + ioe);
} }

+ 48
- 5
src/org/apache/fop/servlet/FopPrintServlet.java View File

/* /*
* $Id$ * $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; package org.apache.fop.servlet;


import java.io.File; import java.io.File;

+ 48
- 5
src/org/apache/fop/servlet/FopServlet.java View File

/* /*
* $Id$ * $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; package org.apache.fop.servlet;


import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;

Loading…
Cancel
Save