Skip to content

Support custom data sources #28

@bvitaliyg

Description

@bvitaliyg

Currently, PdfiumAndroid, and subsequently, PdfiumAndroidKt support only 2 data sources: ByteArray and ParcelFileDescriptor. While this works for most of the cases, sometimes you might need to load the data from InputStream or remote file (for instance, using something like Apache VFS). There's no ParcelFileDescriptor in such cases, and loading the entire content to the RAM is very inefficient and could lead to OOMs.

I checked out the source, and it turns out, Pdfium does support custom data sources – and it's already used in the project:

FPDF_DOCUMENT document = FPDF_LoadCustomDocument(&loader, cpassword);

So it could be possible to have a custom data source. All that needed to be done is creating an interface for representing the data source, adding corresponding newDocument() methods to PdfiumCore, and implement these methods in C++, using JNI to call callback methods from that interface.

Can this be implemented? I could try to make the PR if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions