2013-10-07 61 views
1

IAM已经完成了我的PDF查看,但现在我只想查看动态PDF文件的弹出窗口无法下载选项并保存选项,请现在就举一些例子说明在java中 IAM使用此代码如何显示在JSP中弹出ü窗口PDF文件

File f= new File(file); 
if(f.exists()){ 
ServletOutputStream op= response.getOutputStream(); 
response.reset(); 
if(check==1){ 
response.setContentType("application/pdf"); 
}else{ 
response.setContentType(content); 
        } 
// response.setHeader("Content-disposition","attachment;  filename=" +fileName); 
byte[] buf = new byte[4096]; 
int length; 
DataInputStream in = new DataInputStream(new FileInputStream(f)); 
while ((in != null) && ((length = in.read(buf)) != -1)){ 
op.write(buf,0,length); 
      } 
in.close(); 
op.flush(); 
op.close(); 
    } 
+0

我在这里回答了这个问题。 http://stackoverflow.com/questions/19591425/add-pdf-and-tiff-to-the-same-pdf-document-and-display-it-in-the-browser?noredirect=1#comment29331909_19591425 – DJR

+0

我回答在这里。我的pdf在不同的窗口打开。 http://stackoverflow.com/questions/19591425/add-pdf-and-tiff-to-the-same-pdf-document-and-display-it-in-the-browser?noredirect=1# comment29331909_19591425 – DJR

回答