com.sun.image.codec.jpeg.*就在rt.jar中啊。
net.xdevelop.util.ParamUtil没听说过,估计是举例的人自己定制的。
其实用com.sun.image.codec.jpeg.*即可实现简单的图文输出。

解决方案 »

  1.   

    下面是个简单的例子:
    /*
     * iSee Software License, Version 1.0
     *
     * Copyright (c) 2002 iSee Studio.  All rights reserved.
     *
     * 爱思时代科技版权所有
     *
     */
    package isee.utility ;import com.sun.image.codec.jpeg.JPEGCodec ;
    import com.sun.image.codec.jpeg.JPEGImageEncoder ;//import java.awt.image.geom.*;
    //import java.awt.AlphaComposite;
    import java.awt.Color ;
    import java.awt.Font ;
    import java.awt.Graphics2D ;
    import java.awt.RenderingHints ;
    import java.awt.image.BufferedImage ;import java.io.OutputStream ;/**
     *  <p>
     *
     *  Title: </p> <p>
     *
     *  Description: </p> <p>
     *
     *  Copyright: Copyright (c) 2002</p> <p>
     *
     *  Company: </p>
     *
     *@author     unascribed
     *@created    2002年8月7日
     *@version    1.0
     */
    public class ImageUtility
    {
        //~ Constructors ..........................................................    //~ Methods ...............................................................    /**
         *  方法描述。
         *
         *@param  out   Description of the Parameter
         *@param  text  Description of the Parameter
         */
        public final static void writeTextImage ( OutputStream out , String text )
            throws java.io.IOException
        {
            int height = 16 ;
            int fontSize = 12 ;
            int width = text.length () * ( fontSize - 3 ) + 1 ;
            BufferedImage image = new BufferedImage ( width , height ,
                                                      BufferedImage.TYPE_INT_RGB ) ;
            Graphics2D g2D = ( Graphics2D ) image.getGraphics () ;
            g2D.setRenderingHint ( RenderingHints.KEY_ANTIALIASING ,
                                   RenderingHints.VALUE_ANTIALIAS_ON ) ;        // Clear image with transparent alpha by drawing a rectangle
            //        g2D.setComposite( AlphaComposite.getInstance( AlphaComposite.CLEAR,
            //                                                      0.0f ) );
            //Rectangle2D.Double rect = new Rectangle2D.Double( 0, 0, width, height );
            //g2D.fill( rect );
            g2D.setColor ( Color.white ) ;
            g2D.fillRect ( 0 , 0 , width , height ) ;
            g2D.setColor ( Color.black ) ;
            g2D.setFont ( new Font ( "SansSerif" , Font.BOLD , fontSize ) ) ;        int left = 2 ; //( width - fontSize * text.length() / 2 ) / 2;
            g2D.drawString ( text , left , 12 ) ;        JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder ( out ) ;
            encoder.encode ( image ) ;
        }
    }
      

  2.   

    这样做其实还是只输出了图片,只不过文字再图片上而已!如果是一个表格,其中有的是文字,有的是图片,在不使用文件、使用其它Servlet的情况下如何输出?