title: Not able to get the pdf from internet
body: <p>I am trying to download the pdf content from the internet and download it to a local file.
  I am using iText for reading the pdf and using Java stream to write it.</p>
  
  <p>After writing the file, new file can not be opened in the PDF reader.</p>
  
  <pre><code>PdfReader reader = new PdfReader(strURL);
  FileOutputStream fos = new FileOutputStream(new File(fileName));
  fos.write(reader.getPageContent(1));
  fos.flush();
  fos.close();
  </code></pre>
  
  <p>I am trying to get the PDf from <a href="http://epaper.udayavani.com/PDF/MANIPAL/2013-06-18/man18061301medn.pdf" rel="nofollow">this link</a></p>
  
  <p>I am debugged few things. Here are the findings.</p>
  
  <blockquote>
    <p>reader.getEofPos()</p>
  </blockquote>
  
  <p>gives 291633, Which is same as file length.But </p>
  
  <pre><code>reader.getPageContent(1).length;
  </code></pre>
  
  <p>gives  only 42360 bytes. Clearly byte read are less than the actual size.</p>
  
  <p>Only one page of pdf is present</p>
  
  <pre><code>reader.getNumberOfPages() =1 
  </code></pre>
  
  <p>Do i need to specify few more things to reader to read the entire pdf file?</p>