title: Get a single page from pdf document and display in jsp page
body: <p>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.</p>
  
  <p>Here is my jsp code</p>
  
  <pre><code>&lt;div class="showpdf" style="margin-left: 10%;"&gt;
      &lt;object id="pdfPage"
          data="${pageContext.request.contextPath}/&lt;%=session.getAttribute("fileName")%&gt;"
          type="application/pdf" width="191" height="207" title=""&gt;
      &lt;/object&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>here is my servlet code</p>
  
  <pre><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());
  </code></pre>
  
  <p>Here is code to get a single page from pdf using pdfbox</p>
  
  <pre><code>File PDF_Path = new File("C:\\PDF.PDF");
      PDDocument inputPDF = PDDocument.load(PDF_Path);
      List&lt;PDPage&gt; allPages = inputPDF.getDocumentCatalog().getAllPages();
      inputPDF.close();
      PDPage testPage = (PDPage)allPages.get(0);
  </code></pre>