Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #11839 Reply


    PDF Open Fail from assets folder, and this is a log.

    01-01 18:23:07.960: E/PlugPDF(11347): [ERROR] java.lang.Exception: Failed to open from data. Because,
    01-01 18:23:07.960: E/PlugPDF(11347): Syntax Error: could not find catalog at line 381 (Gf_Error* Pdf_File::repairXref(streams::InputStream*) : ././../../../../../../ext/pdfv/src/file/file_repair.cpp)

    SimpleDocumentReader mReader = SimpleReaderFactory.createSimpleViewer(this, listener);
    AssetManager assetManager = getAssets();

    File file = new File(getFilesDir(), “test.pdf”);
    InputStream in =“test.pdf”);
    OutputStream out = openFileOutput(file.getName(), Context.MODE_WORLD_READABLE);
    byte[] buffer = new byte[1024];
    int read;
    while ((read = != -1)
    out.write(buffer, 0, read);
    in = null;
    mReader.openData(buffer, buffer.length, “”);
    out = null;
    } catch (Exception e)
    Log.e(“tag”, e.getMessage());

    #11840 Reply

    Dr. Plug

    Hello Jade,

    Thank you for your inquiry.
    In our sample project, there is example that open pdf in asset folder.
    The readAssetFile method in the ReaderActivity class or the ReaderWithControllerActivity class will help you to do that.

    I hope this will be helpful to you.

    Best regards,

    PlugPDF Support

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: how to opern pdf from assets folder(Android SDK)
Your information: