title: How can i extract image from button icon in PDF using Apache PDFBox?
body: <p>I want to get image icon from button in pdf using java netbeans, and put it in some panel.
  However i hit a brick here.
  I'm using PDFBox as my PDF exporter, and i can't seem to understand enough. 
  I already succeed reading from the form field, but there is no button extractor as long as i try to find it in PDFBox.
  How should i made it ? And is it possible using this method, or is there any other way around.
  Thanks in advance.</p>
  
  <p>Edit : 
  I already found to extractimages using the one that are in example utility using this code :                 </p>
  
  <pre><code>       File myFile = new File(filename);
          try { 
  
              //PDDocument pdDoc = PDDocument.loadNonSeq( myFile, null );
              PDDocument pdDoc = null;
              pdDoc = PDDocument.load( myFile );
              PDDocumentCatalog pdCatalog = pdDoc.getDocumentCatalog();
              PDAcroForm pdAcroForm = pdCatalog.getAcroForm();
              // dipakai untuk membaca isi file
  
              List pages = pdDoc.getDocumentCatalog().getAllPages();
              Iterator iter = pages.iterator();
               while( iter.hasNext() )
               {
                   PDPage page = (PDPage)iter.next();
                   PDResources resources = page.getResources();
                   Map images = resources.getImages();
                   if( images != null )
                   {
                       Iterator imageIter = images.keySet().iterator();
                       while( imageIter.hasNext() )
                       {
                           String key = (String  )imageIter.next();
                           PDXObjectImage image = (PDXObjectImage)images.get(key);
                           BufferedImage imagedisplay= image.getRGBImage();
                           jLabel5.setIcon(new ImageIcon(imagedisplay)); // NOI18N                                 
                       }
                   }
               }
  
  
          } catch (Exception e) {
                 JOptionPane.showMessageDialog(null, "error " + e.getMessage());
  
  
          }
  </code></pre>
  
  <p>However i still fail reading from the button images.
  Btw i read the tutorial from this page to add button images to pdf.
  <a href="https://acrobatusers.com/tutorials/how-to-create-a-button-form-field-to-insert-a-pdf-file" rel="nofollow">https://acrobatusers.com/tutorials/how-to-create-a-button-form-field-to-insert-a-pdf-file</a>
  <br> 
  2nd Edit : 
  Here i also give you the link to the pdf that has icon in it. <a href="http://www.docdroid.net/TDGVQzg/imageicon.pdf.html" rel="nofollow">PDF Link</a>.
  Thank you in advance.</p>