I am new to android can you please show me example to convert a Pdf file pages into bitmaps in android.
So, that i can display as imageview in android
I am new to android can you please show me example to convert a Pdf file pages into bitmaps in android.
So, that i can display as imageview in android
I tried many PDF libraries, the fastest is Mobi PDF Viewer SDK. Do this:
public Bitmap getPiece(String path, String password, int importWidth, int importHeight, int piece_x, int piece_y, int piece_w, int piece_h)
    {
        Document myDoc = new PDFDocument (path); 
        myDoc. Open (path, password); 
        Bitmap result = Bitmap.createBitmap(piece_w, piece_h, Config.ARGB_8888);
        result.eraseColor(0xFFFFFFFF);
        Page page = m_doc.GetPage(pageNumber);
        float w = m_doc.GetPageWidth(pageNumber);
        ratio = importWidth/w;
        w = m_doc.GetPageWidth(pageNumber) * ratio;
        float h = m_doc.GetPageHeight(pageNumber) * ratio;
        Matrix mat = new Matrix(ratio, -ratio, -piece_x, h - piece_y);
        page.RenderToBmp(result, mat);
        page.Close();
        return result;
    }
I used this libary to did that
https://github.com/jblough/Android-Pdf-Viewer-Library
The instuctions are there, and is easy to implement.