title: How to open pdf file on particular area of the screen in Android
body: <p>I have requirement at which, on my screen header label is there and on the bottom 
      of the screen one button is there. I want to show PDFs file between this label 
      and button how I will implement this? When I am trying to open PDFs It's taking full 
      screen space.</p>
  
  <pre><code>      File file = new File(getFilesDir(), "mypdf.pdf");
  
  
          try {
              fis = new FileInputStream(file);
          } catch (FileNotFoundException e1) {
              // TODO Auto-generated catch block
              e1.printStackTrace();
          }
          //System.out.println(file.exists() + "!!");
          //InputStream in = resource.openStream();
          ByteArrayOutputStream bos = new ByteArrayOutputStream();
          byte[] buf = new byte[1024];
          try {
              for (int readNum; (readNum = fis.read(buf)) != -1;) {
                  bos.write(buf, 0, readNum); //no doubt here is 0
                  //Writes len bytes from the specified byte array starting at offset off to this byte array output stream.
                  System.out.println("read " + readNum + " bytes,");
              }
          } catch (IOException ex) {
              ex.printStackTrace();
          }
          byte[] bytes = bos.toByteArray();
  
          //below is the different part
          File someFile = new File("java2.pdf");
          try {
              FileOutputStream fos = new FileOutputStream(someFile);
              fos.write(bytes);
              fos.flush();
              fos.close();
          } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          Intent intent = new Intent(Intent.ACTION_VIEW);
          intent.setDataAndType(
                  Uri.parse("file://" + getFilesDir() + "/java2.pdf"),
                  "application/pdf");
  
          startActivity(intent);
  </code></pre>