日期:2014-05-17  浏览次数:20785 次

求实现PDF预览的思路
如题。最好能简单介绍一下实现方法。
有几个疑问,也请看看。
1.如果不用flash预览,就像html中显示图片一样,怎么实现?
2.哪位知道PDFRenderer.jar 是不是可以进行免费商业开发?
谢谢。
预览

------解决方案--------------------
1. iReport + jasperreport 报表 试试
2. PDFRenderer.jar 是开源的
------解决方案--------------------
html 中 object classid引用PDF插件直接显示出来!
------解决方案--------------------
只需要电脑上安装了PDF插件就可以直接显示了!
------解决方案--------------------
我用的是pdf2swf+FlexPaper做的
------解决方案--------------------
pdf 转 swf 然后用swf播放器播放。网上很多的。
------解决方案--------------------

<%
   out.clear();
   out = pageContext.pushBody();
   response.setContentType("application/pdf");
  
   try
   {
   String strPath = new String("E:\\velocity.pdf");
   File file = new File(strPath);
   if(file.exists())
   {
   //DataOutputStream temp = new DataOutputStream(response.getOutputStream());
   //DataInputStream input = new DataInputStream(new FileInputStream(strPath));
  
   InputStream input = new FileInputStream(strPath);
   OutputStream temp = response.getOutputStream();
  
   byte b[] = new byte[2048];
   while((input.read(b)) != -1)
   {
   temp.write(b);
   temp.flush();
   }
   input.close();
   temp.close();
   }
   else
   {
   out.println("文件不存在!");
   }
   }
   catch(Exception e)
   {
   e.printStackTrace();
   }
  
  %>

一般在jsp页面里直接这么写就可以了,但前提是电脑得装了adobe pdf
我记得,没有装的话,只有火狐浏览器可以预览,其他的都是下载文件