AndroidPdfViewer
AndroidPdfViewer copied to clipboard
Search Text Inside PDF
Hi, could we search text inside pdf?
the code has not been wrote yet, but feel free to submit any development you can add to doing this.
Ya search text feature is needed to me too
me to, is it easy? seems it's a common function
i need this feature too, please add
i need this too. please add this feature or help how we can do it. thanks
@dvMadMan i found a better way to render pdf files on android with auto search ability if you want to know tell me know
@ghost1372 How?
@AhmerAfzal1 you must use javascript library just download and copy pdfjs lib in your assets folder then put a webview in your activity in last step show your pdf like this:
webview = (WebView) findViewById(R.id.webview);
WebSettings settings = webview.getSettings();
settings.setJavaScriptEnabled(true);
settings.setAllowFileAccessFromFileURLs(true);
settings.setAllowUniversalAccessFromFileURLs(true);
settings.setBuiltInZoomControls(true);
webview.setWebChromeClient(new WebChromeClient());
webview.loadUrl("file:///android_asset/pdfjs/web/viewer.html?file=" + pdfPath);
note: library must be this folder like this:
Assets-->pdfjs-->
build
web
Mozilla Pdfjs
@ghost1372 this way is very slow for my phone. this AndroidPdfViewer better, but need search ))))
@dvMadMan yes because use webview and js, so its slow, but it has automatic search functionality And the much smaller size of this library.
Thank you! @ghost1372 but we need this function built in this library.
@AhmerAfzal1 @dvMadMan @liupeng826 @nusagates @1stmetro @Sumit-Chakole i found a solution for this check this repo https://github.com/foobnix/LibreraReader it can read and search pdf files with MuPDF lib maybe @barteksc can analysis this repo and add this
Opensource version od MuPDF od licensed under AGPL license, which requires you to publish source code of your app
@barteksc i dont have problem with this all of my works is free and open source
@barteksc , is there any chance of getting search feature in Pdfviewer library?
Try this https://github.com/thevikke/read_pdf_text/blob/master/android/src/main/java/com/example/read_pdf_text/ReadPdfTextPlugin.java
@ghost1372 How?
https://github.com/vimalcvs/PDFTextSearch/blob/main/app/src/main/java/com/example/pdftextsearch/MainActivity.java
pdfium should have this function, the problem is to implement it for android. I remember the old app "google pdf viewer" which however was based on pdfium and had this function
I did some research and found some libraries that have implemented the search, but I don't know if they work, they should be tested. It would take someone to test them and maybe fork and keep an updated fork.
Test them and let me know if they work in any way
https://github.com/gulshan98185/AndroidPdfViewer
https://github.com/beeline09/AdvancedPdfView
https://github.com/beeline09/android-support-pdfium
https://github.com/benjinus/android-support-pdfium