title: how to create pdf file with multiple pages from image file in android
body: <p>How to create PDF file with multiple pages from image file in Android?  I created one PDF file from image. That PDF file has one page. That is half of that image. In the right side search part is cut in PDF file. 
  I am using itext-5.3.4.jar for create PDF.</p>
  
  <pre><code>    wbviewnews.loadUrl("http://developer.android.com/about/index.html");
     // button for create wbpage to image than image to PDF file
              Button  btnclick =(Button)findViewById(R.id.btnclick);
              btnclick.setOnClickListener(new OnClickListener() {
  
              @Override
              public void onClick(View v) {
                  // TODO Auto-generated method stub
  
                  Picture p = wbviewnews.capturePicture();
                  bitmap=null;
  
  
                  PictureDrawable pictureDrawable = new PictureDrawable(p);
  
                  bitmap = Bitmap.createBitmap(pictureDrawable.getIntrinsicWidth(),pictureDrawable.getIntrinsicHeight(), Config.ARGB_8888);
                  //Bitmap bitmap = Bitmap.createBitmap(200,200, Config.ARGB_8888);
                  Canvas canvas = new Canvas(bitmap);
                  canvas.drawPicture(pictureDrawable.getPicture());
  
                  ImageView imgdata=(ImageView)findViewById(R.id.imgdata);
                  imgdata.setImageBitmap(bitmap); 
  
                  String filename = "pippo.png";
                  File sd = Environment.getExternalStorageDirectory();
  
                  File dest = new File(sd, filename);
                  String pdffilename = "pippo.pdf";
                  File pdffilepath = new File(sd, pdffilename);
  
  
                  try {
                      FileOutputStream out = new FileOutputStream(dest);
  
                      bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
                      out.flush();
                      out.close();
  
                  } catch (Exception e) {
                      e.printStackTrace();
                      Log.e("Exception", e.toString());
                  }
  
                  Document document=new Document();
  
  
                  try {
                      Log.e("pdffilepath", pdffilepath.toString());
                      PdfWriter writer = PdfWriter.getInstance(document,new FileOutputStream(pdffilepath));
                      document.open();
  
                      //  URL url = new URL (Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+filename);
                      //  Log.e("url", url.toString());
                      Image image = Image.getInstance(Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+filename) ;
  
                      document.add(image);               
                      document.close();
                  } catch (FileNotFoundException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                      Log.e("FileNotFoundException", e.toString());
                  } catch (DocumentException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                      Log.e("DocumentException", e.toString());
                  } catch (MalformedURLException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                      Log.e("MalformedURLException", e.toString());
                  } catch (IOException e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                      Log.e("IOException", e.toString());
                  }
  
              }
          });
  </code></pre>