In my current application i'm able to load total pdf document by using html object and view in jsp page. but i need to show every single page in the document seperately like thumbnail view in adobe reader.
Here is my jsp code
<div class="showpdf" style="margin-left: 10%;">
<object id="pdfPage"
data="${pageContext.request.contextPath}/<%=session.getAttribute("fileName")%>"
type="application/pdf" width="191" height="207" title="">
</object>
</div>
here is my servlet code
File file = new File("D:/IIV 3 Project/Documents/Invoices/invoices/"+fileName+"");
response.setHeader("Content-Type", getServletContext().getMimeType(file.getName()));
response.setHeader("Content-Length", String.valueOf(file.length()));
response.setHeader("Content-Disposition", "inline; filename=\""+fileName+"\"");
Files.copy(file.toPath(), response.getOutputStream());
Here is code to get a single page from pdf using pdfbox
File PDF_Path = new File("C:\\PDF.PDF");
PDDocument inputPDF = PDDocument.load(PDF_Path);
List<PDPage> allPages = inputPDF.getDocumentCatalog().getAllPages();
inputPDF.close();
PDPage testPage = (PDPage)allPages.get(0);