私はすでに私のpdfビューを行っていますが、今は動的にpdfファイルを表示したいだけですダウンロードオプションと保存オプションではなく、動的にpdfファイルを表示したいので、Javaでいくつかの例を挙げてください。今すぐこのコードを使用してください
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();
}