title: Reading Pdf from URL and Parsing with Android PDF Viewer
body: <p>I have successfully displayed Pdf from <code>Assets</code> folder using <code>Android Pdf Viewer</code> library <a href="https://github.com/jblough/Android-Pdf-Viewer-Library" rel="nofollow">https://github.com/jblough/Android-Pdf-Viewer-Library</a>. I am now trying to parse and display online pdf "<a href="http://www.gnostice.com/downloads/Gnostice_PathQuest.pdf" rel="nofollow">http://www.gnostice.com/downloads/Gnostice_PathQuest.pdf</a>" but it is giving the following error:</p>
  
  <pre><code>&lt;code&gt;
  04-19 03:17:04.995: W/System.err(27806): java.io.IOException: This may not be a PDF File
  04-19 03:17:04.995: W/System.err(27806):    at com.sun.pdfview.PDFFile.parseFile(PDFFile.java:1395)
  04-19 03:17:04.995: W/System.err(27806):    at com.sun.pdfview.PDFFile.&lt;init&gt;(PDFFile.java:140)
  04-19 03:17:04.995: W/System.err(27806):    at com.sun.pdfview.PDFFile.&lt;init&gt;(PDFFile.java:116)
  04-19 03:17:04.995: W/System.err(27806):    at net.sf.andpdf.pdfviewer.PdfViewerActivity.openFile(PdfViewerActivity.java:909)
  04-19 03:17:04.995: W/System.err(27806):    at net.sf.andpdf.pdfviewer.PdfViewerActivity$8.run(PdfViewerActivity.java:863)
  04-19 03:17:04.995: W/System.err(27806):    at java.lang.Thread.run(Thread.java:1027)
  
  &lt;/code&gt;
  </code></pre>
  
  <p>I am opening <code>URL Connection</code> connection as :</p>
  
  <pre><code>&lt;code&gt;
  fileUrl = new URL(filename);
                      HttpURLConnection connection = (HttpURLConnection)fileUrl.openConnection();
                      connection.connect(); 
                      InputStream is = connection.getInputStream();                   
                      byte[] bytes = new byte[is.available()];
                      is.read(bytes);
                      System.out.println("Byte Lenght: " + bytes.length);
                      ByteBuffer bb = ByteBuffer.NEW(bytes);
                      is.close();
                      openFile(bb, password);
  &lt;/code&gt;
  </code></pre>
  
  <p>Please help what can be the issue?</p>
  
  <p>Thanks</p>