I am generating a pdf file for gate pass from my web application through servlet. I want to open this newly generated pdf in new window/tab and user should come back to the application from servlet. How can i open pdf in new window/tab? I am generating pdf from itext api. My servlet code snippet is:
response.setHeader("Expires", "0");
response.setHeader("Cache-Control","must-revalidate, post-check=0,precheck=0");
response.setHeader("Pragma", "public");
response.setContentType("application/pdf");
response.setContentLength(baos.size());
OutputStream os = response.getOutputStream();
baos.writeTo(os);
os.flush();
os.close();
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…