In my app I plan to have a at least 40 different pdf files that come out to about 4gb obviously that's way to much to jave inside an app with out a live data storage so my question is. Is it possible to have the files apart of the app and when the users download the app it goes in there phones or devices internal storage for location to where in side the app the people will click a button and it can open up the pdf file inside the app without it being slow or needed a data connection. Also I'm building this in android studio using kotlin.
CodePudding user response:
To open multiple PDF files in an Android app, you can use a PDF viewer library that supports multiple document interfaces (MDI). Some popular options include:
MuPDF: This is a lightweight and fast PDF viewer that supports MDI. You can use the MuPDFPageView class to display each PDF document in its own tab or window.
Android PDF Viewer: This is a customizable and feature-rich PDF viewer that supports MDI. You can use the PdfView class to display each PDF document in its own tab or window.
PSPDFKit: This is a commercial PDF viewer library that offers a wide range of features, including support for MDI. You can use the PdfFragment class to display each PDF document in its own fragment or window.
To use one of these libraries in your app, you will need to include the library in your project and use its API to open and display the PDF files.
For example, using MuPDF, you could do something like this:
// Create a new MuPDFPageView for each PDF document
MuPDFPageView pageView1=new MuPDFPageView(context, document1);
MuPDFPageView pageView2=new MuPDFPageView(context, document2);
MuPDFPageView pageView3=new MuPDFPageView(context, document3);
// Add the page views to a container or layout in your app
container.addView(pageView1);
container.addView(pageView2);
container.addView(pageView3);