Angelo Lee's Blog
This is my kingdom .If i don't fight for it ,who will ?

Method1:Open pdf using pdf reader, such as Adobe Reader

Step1:页面contentType为text/html

<%@ page  contentType="text/html; charset=gbk"
 pageEncoding="UTF-8"%>

Step2:生成PDF文件路径

String filePath =" http://locast:8080/myproject/ext/temp/test.pdf";  

Step3:请求转发,访问PDF文件

if (filepath.endsWith(".pdf")) {
     response.setContentType("application/pdf");//很重要,不然直接打开pdf会乱码
     response.sendRedirect(filepath);
}


Method2:

Step1:PDF Convert To SWF

swftools official website:http://www.swftools.org/

下载后可以cmd调用命令
 C:\Program files\swftools>pdf2swf.exe c:\\1.pdf c:\\1.swf -s languagedir=c:\\xpdf\\chinese-simplified

后面languagedir是对编码进行处理,可以到官网:http://www.foolabs.com/xpdf/download.html这里去下载windows系统的xpdf,然后拷贝到c盘根目录下,然后下载语言包
  • Chinese/simplified: xpdf-chinese-simplified.tar.gz (907207 bytes)
  • 下载后,然后复制到xpdf下面,具体可以看路径分析 c:\\xpdf\\chinaese-simplified
Step2:Open swf using flexpaper control in jsp

FlexPaper Official Website:http://flexpaper.devaldi.com/default.jsp
download 里面有例子,好像需要部署到程序上才能看到,别下载下来打开。

posted on 2012-12-05 23:10  Angelo Lee  阅读(278)  评论(0编辑  收藏  举报