I want to display pdf file in webpage using iframe with spring framework. Instead of download options i have to show pdf file in my webpage. Pls anyone can help me.
Thanks in advance..
My java code:
Employee employee = employeeManager.getObjectOrNull(
Employee .class, id);
File file = new File(dir,
employee .getFileName());
org.apache.commons.io.FileUtils.writeByteArrayToFile(file,
employee .getfile());
if (employee != null) {
ControllerUtils.openFile(dir,
response, employee.getFileName());
String contentType = Utils.getContentType(employee
.getFileName());
response.setContentType(contentType);
response.setHeader("Cache-Control", "private, max-age=5");
I’ve got the solution. I used
embedtag. My HTML code:My java code