Esempio n. 1
0
  public static void main_2(String[] args) throws IOException, DocumentException {

    PdfReader reader = new PdfReader(iconFile.getAbsolutePath());

    for (int i = 0; i < reader.getXrefSize(); i++) {

      PdfObject pdfobj = reader.getPdfObject(i);

      if (pdfobj == null || !pdfobj.isStream()) {
        continue;
      }

      PdfStream stream = (PdfStream) pdfobj;
      PdfObject pdfsubtype = stream.get(PdfName.SUBTYPE);

      if (pdfsubtype != null && pdfsubtype.toString().equals(PdfName.IMAGE.toString())) {

        System.out.println(stream);

        byte[] imgData = PdfReader.getStreamBytesRaw((PRStream) stream);

        System.out.println(Hex.encodeHex(imgData));
      }
    }
  }