10

I am developing PDF reader application. I am using Radaee PDF reader sdk. I am trying this sdk to open a PDF from the asset in android. I need some help for this. I am using some code like:

    m_vFiles = new PDFGridView(this, null);
    m_vFiles.PDFSetRootPath("/mnt");
    m_vFiles.setOnItemClickListener(this);
    setContentView(m_vFiles);

But it is taking the path of sd card and showing all the pdf file.

One user has used this sdk. https://chat.stackoverflow.com/users/1503155/lazy-ninja

Community
  • 1
  • 1
Biplab De
  • 1,342
  • 10
  • 30
  • I just solved problem of opening PDF in android using android-PDFView library. check out following link that may help you. http://stackoverflow.com/questions/24183472/unable-to-open-pdf-in-android-using-pdfview – DCoder Jun 12 '14 at 13:13
  • 1
    I have purchased the Radaee premium sdk. If anyone has already used this sdk please help me. I am able to show a pdf from sd card but not from the asset. – Biplab De Jun 14 '14 at 05:48
  • can you provide me example code for view pdf file using radeepdf ? – asliyanage Oct 02 '14 at 11:43
  • 1
    @BiplabDe Is radaee free?! for free/open source projects?! – Dr.jacky Jun 13 '15 at 07:09
  • @BiplabDe - Can you post the solution ? – Jaydev May 20 '16 at 08:54
  • Worst library I ever used. If you can buy something else do not think long. Architecture for IOS is terrible. Although support is working quickly. – Eugene P Oct 27 '17 at 15:42

2 Answers2

5

To open a pdf from assets using RadaeePDF, you can do the following into your activity:

private PDFReader m_vPDF = null;
private Document doc = new Document();
private PDFAssetStream stream = new PDFAssetStream();

public void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    Global.Init(this);

    m_vPDF = new PDFReader(this);
    doc.Close();
    stream.open(getAssets(), "test.pdf");

    int ret = doc.OpenStream(stream, null);
        //int ret = doc.Open("/sdcard/test1.pdf", null);
        switch( ret )
        {
            case -1://need input password
                finish();
                break;
            case -2://unknown encryption
                finish();
                break;
            case -3://damaged or invalid format
                finish();
                break;
            case -10://access denied or invalid file path
                finish();
                break;
            case 0://succeeded, and continue
                break;
            default://unknown error
                finish();
                break;
        }

    m_vPDF.open(doc);

    setContentView( m_vPDF );
}
Nermeen
  • 15,883
  • 5
  • 59
  • 72
4

There is another way to open a pdf from any external path

        m_doc.Close();          
        int ret = m_doc.Open( book_path[string path of pdf], null );
        switch( ret )
            {
                case -1://need input password
                    finish();
                    break;
                case -2://unknown encryption
                    finish();
                    break;
                case -3://damaged or invalid format
                    finish();
                    break;
                case -10://access denied or invalid file path
                    finish();
                    break;
                case 0://succeeded, and continue
                    break;
                default://unknown error
                    finish();
                    break;
            }

        m_doc.SetCache( Global.tmp_path + "/temp.dat" );//set temporary cache for editing

        System.out.println(">>>>>>>>path"+m_doc.GetPageCount());
        m_reader.PDFOpen(m_doc, false, this);
Biplab De
  • 1,342
  • 10
  • 30