PdfViewer icon indicating copy to clipboard operation
PdfViewer copied to clipboard

[Suggestion] Implement search (Change Libraries)

Open krmax44 opened this issue 5 years ago • 19 comments

A basic search for finding words would be a very nice feature.

krmax44 avatar Jan 23 '19 16:01 krmax44

This is a difficult feature to implement, some help would be nice!

javacafe01 avatar Jan 23 '19 17:01 javacafe01

i am happy to donate again for this feature if it is implemented.

juliusvonkohout avatar Jun 03 '19 11:06 juliusvonkohout

This would indeed be a really nice feature.

ghost avatar Jun 06 '19 20:06 ghost

+1

retro-78 avatar Jun 10 '19 07:06 retro-78

From what I've seen, PdfViewer is mainly based on the library https://github.com/barteksc/AndroidPdfViewer. Actually That library doesn't enable searching text, some people also asked the developers to add that functionality to it.

I've been searching a way to implement it, I don't really see how to do it but maybe that library can help https://github.com/TomRoush/PdfBox-Android, it's an adaptation of Apache PDFBox to make it work on Android. Currently I can get the text of a pdf with TomRouch's PdfBox so I guess it's a start to do some string search on it, but I don't really see how to higlight text with barteksc's PdfView...

I also don't know if that's a good way to do it, but well if I got it to work I will share it with you.

PFayoux avatar Jul 31 '19 19:07 PFayoux

I've searching more stuff about text searching and actually text operation on a PDF like simply copy text from the PDF. Those features cannot and will not be available, if PdfViewer still use barteksc/AndroidPdfViewer as main library to open a PDF.

The main reason of this is barteksc/AndroidPdfViewer treat a PDF like a bitmap image, so it make it impossible to do anything related to text treatment.

If PdfViewer wants those feature it need another library.

PFayoux avatar Aug 23 '19 10:08 PFayoux

OK thank you for the information

retro-78 avatar Aug 28 '19 11:08 retro-78

Check out https://mupdf.com/ for library?

jtagcat avatar Jan 05 '20 00:01 jtagcat

I actually have no time to work on this anymore, but sure mupdf is a good library. The mupdf application is good, but not really pretty, a remake of PdfViewer using the mupdf library could be a great thing. And actually, I'm also a bit concerned about the fact that barteksc/AndroidPdfViewer is not maintained anymore, and should be less used and maintained than a library like mupdf, so I don't know if it has not any vulnerability and I also guess that it is less likely to be tested to find if it has any. MuPDF had vulnerability in previous version, but the developer always work to maintain their library.

PFayoux avatar Apr 17 '20 15:04 PFayoux

@PFayoux thanks for the input. These days have been quite busy for me, but I have been thinking for a long time to switch pdf handling libraries. As you know, the one I use is not maintained. I have been looking at MuPDF, and any other suggestions would be great. But as of this time, search cannot be implemented with the current library without some difficult work. I'm going to change this thread to be related with the switch of libraries, if anyone has feature requests regarding search or functions such as in MuPDF, redirect them here.

javacafe01 avatar May 11 '20 00:05 javacafe01

If you change libraries, make sure to add select&copy functionality (This is possible with muPDF according to the people on IRC!).

I am looking for an open-source PDF reader with similar functionality like the Dropbox one (They have exactly what I need while maintaining simplicity). I am willing to donate as well!

One thing which is important to me is simplicity: clean interface and small apk size. Of course, all PDFs including exotic fonts, features, pictures should be displayed correctly.

You might also have a look at OpenReadEra PDF library. It seems to be quite small in size.

darkdragon-001 avatar May 13 '20 10:05 darkdragon-001

Hey all,

Just wanted to update on this. I've been plagued with lots of work from University, and I have layed low on this project for some time. I am planning to do the major backend change and kotlin rewrite over the summer.

javacafe01 avatar Mar 08 '21 03:03 javacafe01

what about combining your look and feel with Orion Viewer? It is based on mupdf and has all the functionality (except printing).

woheller69 avatar Aug 01 '21 20:08 woheller69

Librera Reader is another open source app that can open PDF documents and search for text. Of course, the APK is a bit larger.

0xb1ff avatar Jan 31 '22 18:01 0xb1ff

OK, maybe search for text would be too much for a light PDF viewer, since I use librera pro to open large PDFs like ebooks and stuff, but for the simple one/two pages PDF documents I need a faster lighter viewer like this one. But being able to copy the text is very important to me as it is quite often needed from small documents. Is this option alone still diffiicult to implement? And the thing is, there also is no other open source light PDF viewer that is able for this task.

Jakarrrg avatar Mar 29 '22 20:03 Jakarrrg

Hello guys, I've just seen this issue while browsing the repo. If anyone still needs this functionality, I've forked the project and added it.

You can check my app here I used PdfBox-Android (that @PFayoux mentioned btw) to achieve that. You can learn more on how I did it here.

mudlej avatar Aug 29 '22 01:08 mudlej

Excellent, also copy text works. Just the Print button is missing but this can achieved via share.

woheller69 avatar Aug 29 '22 04:08 woheller69

The Print button is available in the Additional Options. And glad you liked it.

mudlej avatar Aug 29 '22 07:08 mudlej

Finally one pdf viewer that fulfills all my needs. Hope to see it on F-Droid soon

woheller69 avatar Aug 29 '22 07:08 woheller69