title: pdf page convert into image
body: <p>I am trying to convert the pdf page to image.
  i am use PdfViewer.jar file.</p>
  
  <p>hear is my code i want to display converted image into imageview </p>
  
  <pre><code>package com.info.org;
  
  import java.io.File;
  import java.io.FileInputStream;
  
  import net.sf.andpdf.nio.ByteBuffer;
  import android.app.Activity;
  import android.graphics.Bitmap;
  import android.graphics.RectF;
  import android.os.Bundle;
  import android.os.Environment;
  import android.util.Base64;
  import android.widget.ImageView;
  
  import com.sun.pdfview.PDFFile;
  import com.sun.pdfview.PDFPage;
  
  public class PDFImageReadActivity extends Activity {
      /** Called when the activity is first created. */
  
      ImageView imageView;
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          try {
              byte[] bytes;
              setContentView(R.layout.main);
  
              imageView=(ImageView) findViewById(R.id.img);
  
              File file = new File(Environment.getExternalStorageDirectory()+"/infobooks/Book5.pdf");
              if (file.exists()) {
  
                  FileInputStream is = new FileInputStream(file);
                  long length = file.length();
                  bytes = new byte[(int) length];
                  int offset = 0;
                  int numRead = 0;
                  while (offset &lt; bytes.length
                          &amp;&amp; (numRead = is.read(bytes, offset, bytes.length
                                  - offset)) &gt;= 0) {
                      offset += numRead;
                  }
  
                  ByteBuffer buffer = ByteBuffer.NEW(bytes);
                  String data = Base64.encodeToString(bytes, Base64.DEFAULT);
                  PDFFile pdf_file = new PDFFile(buffer);
                  PDFPage page = pdf_file.getPage(1);
  
                  RectF rect = new RectF(0, 0, (int) page.getBBox().width(),(int) page.getBBox().height());
  
                  Bitmap image = page.getImage((int) rect.width(),(int) rect.height(), rect);
                  imageView.setImageBitmap(image);
  
                  //FileOutputStream os = new FileOutputStream(Environment.getExternalStorageDirectory()+ "/pdfImage.jpg");
                  //image.compress(Bitmap.CompressFormat.JPEG, 80, os);
  
              } else {
                  System.err.println("File is not found" + file.getAbsolutePath());
              }
  
          } catch (Exception e) {
              // TODO: handle exception
              System.out.println("Error in main --&gt;&gt;" + e.toString());
          }
  
      }
  }
  </code></pre>
  
  <p>when i run it display error in logcat</p>
  
  <pre><code>06-28 18:12:40.353: E/APV.PDFRenderer(852): do not show images
  
  06-28 18:12:40.353: E/APV.PDFRenderer(852): java.lang.UnsupportedOperationException: do not show images
  
  06-28 18:12:40.353: E/APV.PDFRenderer(852):     at com.sun.pdfview.PDFImage.getImage(PDFImage.java:223)
  
  06-28 18:12:40.353: E/APV.PDFRenderer(852):     at com.sun.pdfview.PDFRenderer.drawImage(PDFRenderer.java:374)
  
  06-28 18:12:40.353: E/APV.PDFRenderer(852):     at com.sun.pdfview.PDFImageCmd.execute(PDFPage.java:654)
  
  06-28 18:12:40.353: E/APV.PDFRenderer(852):     at com.sun.pdfview.PDFRenderer.iterate(PDFRenderer.java:674)
  
  06-28 18:12:40.353: E/APV.PDFRenderer(852):     at com.sun.pdfview.BaseWatchable.run(BaseWatchable.java:101)
  
  06-28 18:12:40.353: E/APV.PDFRenderer(852):     at java.lang.Thread.run(Thread.java:1096)
  </code></pre>
  
  <p>can anyone see the problem?</p>
  
  <p>this code is from this post. 
  <a href="https://stackoverflow.com/questions/8814758/need-help-to-convert-a-pdf-page-into-bitmap-in-android-java">Need help to convert a Pdf page into Bitmap in Android Java</a></p>