试下这样:
//页面输出到PDF
       try{               byte[] bytes = JasperRunManager.runReportToPdf(jasperReport,params,ds);            
            response.setContentType("application/pdf"); 
            response.setContentLength(bytes.length); 
            ServletOutputStream ouputStream = response.getOutputStream(); 
            ouputStream.write(bytes,0,bytes.length); 
            ouputStream.flush(); 
            ouputStream.close();
 
            }catch(Exception ex){
你用JasperViewer.viewReport(jasperPrint);当然是用JRviewer预览!