1

I want to embed a PDF on my webpage that has text I would like to be searchable. Using iframe method does not seem to work (when I click inside the window, ctrl F does not let me search for it.) What is the best way for me to embed the PDF (multiple pages) so that I can search text within the PDF? Can it be done with HTMl5? Or is there some library?

I've tried the techniques on this page: https://pdfobject.com/static.html

I an unable to find and match the text with Ctrl+F when I open up the website in any webbrowser on any of the PDFs. The Ctrl+F appears to only work with HTML text. Please help!

Rolando
  • 58,640
  • 98
  • 266
  • 407
  • Have you seen [this question](http://stackoverflow.com/questions/291813/recommended-way-to-embed-pdf-in-html)? Looks like [PDF.js](https://github.com/mozilla/pdf.js) might be a solution for you – egvaldes Apr 20 '17 at 17:53

1 Answers1

1

is find() what you're looking for? Please read: this SO question

Edit

Mousetrap is a library that allow you to assign shortcuts, May be it's possible to search documents using Mousetrap you might want to try Mousetrap.js project site, github and this site has some examples and maybe it's possible to find text in documents or search documents for text. Please try and read their information..

End edit

You can't do a search in PDF files with html only, you will need other technologies however you can embed a lot of file types with <embed> and display them on your pages using object, embed or frames.. if you want to search text in PDF documents, it would be better to use a php extension that is able to help you out

I hope it's helpful to you

Community
  • 1
  • 1
jagb
  • 912
  • 11
  • 26
  • Problem is I have used as I mentioned in my OP, though was surprised that when I use Ctrl+F, I couldnt match against any text wtihin the PDF, only text that is in the HTML. – Rolando Apr 18 '17 at 14:23
  • Would it solve the issue if you're able to convert the PDF file to HTML and find somthing with `find()` ? There is an [SO answer](http://stackoverflow.com/questions/14782751/convert-pdf-to-html-in-php/20347934#20347934) to another question with a link to [PDFtoHTML](http://sourceforge.net/projects/pdftohtml/), I hope this is helpful to you, if not I'll try to find something better for you.. – jagb Apr 21 '17 at 20:26