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!

1
  • Have you seen this question? Looks like PDF.js might be a solution for you Commented Apr 20, 2017 at 17:53

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Problem is I have used <embed> 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.
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 to another question with a link to PDFtoHTML, I hope this is helpful to you, if not I'll try to find something better for you..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.