How to save multiple images into pdf file
<pre><code> public void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == RESULT_OK) {
            Bundle extras = data.getExtras();
            Bitmap mImageBitmap = (Bitmap) extras.get("data");

            // img.setImageBitmap(mImageBitmap);

            String fpath = Environment.getExternalStorageDirectory()
                    .getAbsolutePath() + "/sample.pdf";
            File file = new File(fpath);
            if (!file.exists()) {
                try {
                    file.createNewFile();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

            Document document = new Document();

            try {
                PdfWriter.getInstance(document, new FileOutputStream(fpath));
            } catch (FileNotFoundException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            } catch (DocumentException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

            document.open();


                ByteArrayOutputStream stream = new ByteArrayOutputStream();
              //  mImageBitmap = BitmapFactory.decodeResource(getBaseContext().getResources(), imagesf[i]);
                mImageBitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);

                try {
                    myImg = Image.getInstance(stream.toByteArray());
                } catch (BadElementException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (MalformedURLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                myImg.setAlignment(Image.MIDDLE);


            try {
                document.add(myImg);
            } catch (DocumentException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            document.close();`enter code here`

        }
    }
</code></pre>

<p>The above code working fine to capture and save one image into pdf file, but my requirement is i need to stored may 4 to 5 images capture which will store in sd card first and then to pdf or directly should get store in pdf anyone solution please help.</p>

<p>Thanks in advance.</p>