分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
需要一个jar PDFRenderer-0.9.0.jar
http://java.net/downloads/pdf-renderer/PDFRenderer-0.9.0.jar
package com.wonders.stpt.attach.action;import java.awt.Image;import java.awt.Rectangle;import java.awt.image.BufferedImage;import java.io.File;import java.io.FileInputStream;import java.io.FilenameFilter;import java.io.FileOutputStream;import java.io.InputStream;import java.io.OutputStream;import java.io.RandomAccessFile;import java.nio.ByteBuffer;import java.nio.channels.FileChannel;import java.util.Arrays;import java.util.Comparator;import javax.imageio.*;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.apache.struts2.convention.annotation.Action;import org.apache.struts2.convention.annotation.Namespace;import org.apache.struts2.convention.annotation.ParentPackage;import org.apache.struts2.convention.annotation.Result;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.beans.factory.annotation.Qualifier;import org.springframework.context.annotation.Scope;import org.springframework.stereotype.Component;import com.sun.image.codec.jpeg.JPEGCodec;import com.sun.image.codec.jpeg.JPEGImageEncoder;import com.sun.pdfview.PDFFile;import com.sun.pdfview.PDFPage;import com.wonders.stpt.attach.model.vo.UploadFile;import com.wonders.stpt.attach.service.FjshService;import com.wonders.stpt.userMsg.action.AbstractParamAction;@SuppressWarnings("serial")@ParentPackage("struts-default")@Namespace(value="/attach")@Component("attachViewerAction")@Scope("prototype")public class AttachViewerAction extends AbstractParamAction{ private FjshService fjshService; private final int maxPage = 30; public FjshService getFjshService() { return fjshService; } @Autowired(required=false) public void setFjshService(@Qualifier("fjshService")FjshService fjshService) { this.fjshService = fjshService; } /** * PDF文档在线以图片格式预览. * */