title: "java.io.IOException: This may not be a PDF File"
body: <p>I want to read a pdf file from a url and convert it into a thumbnail image. I am using   the following code. I didnt included the converting portion here.The problem is on the line "pdffile = new PDFFile(buf);" I get an exception "java.io.IOException: This may not be a PDF File". But I can see the pdf on the browser. What is wrong with me? Please help me. </p>
  
  <pre><code>    byte[] byteArray = null;
      InputStream is = null;
      String streamTo = null;
      BufferedImage bmg = null;
      PDFFile pdffile;
      ByteBuffer buf;
      int pageNumber = 1;
  
      try {
         is = fetchImageFromServer(url); //Pdf Url path
         if (!pageNumber.isEmpty()) {
           streamTo = is.toString(); 
           byteArray = streamTo.getBytes();
           buf = ByteBuffer.wrap(byteArray);
           pdffile = new PDFFile(buf);
         }
      } catch (IOExceptio e) {
      }
  </code></pre>