Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DocumentFile #3

Closed
ENOZA opened this issue Jun 10, 2016 · 4 comments
Closed

DocumentFile #3

ENOZA opened this issue Jun 10, 2016 · 4 comments

Comments

@ENOZA
Copy link

ENOZA commented Jun 10, 2016

Is it possible to make AndroidPdfViewer read a DocumentFile?

Right now, there are fromFile() and fromAsset() but I was thinking it would be great if we have something like fromDocumentFile().

  public Configurator fromDocumentFile(Context context, DocumentFile document_file) {
    if (!document_file.exists()) {
      throw new FileNotFoundException(document_file.getUri().getPath().toString() + " does not exist.");
    }
    return new Configurator(context, document_file);
  }

What I want to do is that I let a user pick up a PDF file using Android's Storage Access Framework and display it on the screen using AndroidPdfViewer.

Right now, I can do this by copying DocumentFile to a temp File instance and pass it to fromFile(). However, I was thinking if I could avoid making a temporary file.

@barteksc
Copy link
Collaborator

Thanks, I will take a look at it

@barteksc
Copy link
Collaborator

I have played with it a little bit. When you pick file using SAF it returns Uri, maybe method fromUri(Uri) will suffice? It is more universal than fromDocumentFile()

@ENOZA
Copy link
Author

ENOZA commented Jun 13, 2016

That's a great idea!
Yes, fromUri() is definitely more universal than fromDocumentFile()!

@barteksc
Copy link
Collaborator

fromUri(Uri) method added in version 1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants