PDFRenderer - How can I render a multiple page pdf to a web view or imageview?
<p>I am new to android development and have been looking for a way to render a pdf that I created. Basically I am trying to render multiple pages and then put them all in a webView where I can scroll down and see each page. As of now the code I have below basically displays the first page and it is in an imageView. Each time I have tried to do multiple pages the pages basically all end up on one view with one on top of another.</p>

<p>Please let me know if you have a way of doing this in a webView.
Example code would be extremely helpful.</p>

<p>Thanks in advance! </p>

<pre><code>try {
            File file = new File(getExternalFilesDir(null).getAbsolutePath(), "document.pdf");
            mPdfDocument.writeTo(new FileOutputStream(file));

            ParcelFileDescriptor fd = ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY);
           // PdfRenderer renderer = new PdfRenderer(ParcelFileDescriptor.open(file, ParcelFileDescriptor.MODE_READ_ONLY));
            PdfRenderer renderer = new PdfRenderer(fd);
            Bitmap bitmap = Bitmap.createBitmap(800, 1000, Bitmap.Config.ARGB_4444);
            int pageCount = renderer.getPageCount();
            if (pageCount== 7) {
                Log.v("its right", "its right");
            } else {
                Log.v("its not right", "its right");
            }

                PdfRenderer.Page pages = renderer.openPage(0);
                pages.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
                pages.close();

            imageView.setImageBitmap(bitmap);

       } catch (IOException e) {
            Log.e("cannot generate pdf", "e");
 }
</code></pre>