title: How to add more data into Pdf file created via iText in android
body: <p>I am working on a project to create Pdf files from edit text fields in android. I had researched a lot from the internet on how to do this, found mainly two libraries iText and Apwlibrary to do this, but I couldn't find any reliable code which does this without error, nor any tutorial which covered all the areas which need attention for this to work. Somehow I combined a little from everything and my very limited knowledge of android in order to make a basic pdf file, but now I am stuck and I dont know how to add more data into the pdf file. This is the code I came up with in the end.</p>
  
  <pre><code>private void createPdf() throws FileNotFoundException{
  
     File pdfFolder=new File(Environment.getExternalStoragePublicDirectory(
             Environment.DIRECTORY_DOCUMENTS),"pdfdemo");
     if(!pdfFolder.exists()){
         pdfFolder.mkdir();
         Log.d("SelfNoteFragment"," Pdf Created");
     }
  
     Date date = new Date();
     String timeStamp=new SimpleDateFormat("yyyMMdd_HHmmss").format(date);
     File myFile= new File(pdfFolder+timeStamp+".pdf");
     OutputStream outputStream=new FileOutputStream(myFile);
  
     PdfDocument pdfDocument= new PdfDocument();
     DisplayMetrics displayMetrics = new DisplayMetrics();
  
     getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
     int height=displayMetrics.heightPixels,
             width=displayMetrics.widthPixels;
     PdfDocument.PageInfo pageInfo= new PdfDocument.PageInfo.Builder(width,height,4).create();
     PdfDocument.Page page=pdfDocument.startPage(pageInfo);
     mRootView.draw(page.getCanvas());
     pdfDocument.finishPage(page);
     try{
         pdfDocument.writeTo(outputStream);
  
     }catch (IOException e){
  
     }
  </code></pre>
  
  <p>}</p>
  
  <p>I am a rookie, so if the question doesnt contain relevant points or if the question is vague, plaese specify in the comments below.I have wen through the android documentation regarding the code, but due to my limited knowledge I couldnt figure out what to do.I am trying to be as specific as possible, but if the question still sounds vague, please specify the points needed and I will be more specific. Thank You.</p>