pdf is typeset to produce a visual output, it's not strictly required to even contain text information. Imagine it as a printer's board with lead letters put into it. Every letter is a box with absolute position, size and style. So are all the images and so on. If you have a mathematical formula in it, you can see where the problem is: who said the text is linear? You have a jumble of glyphs, each positioned and sized however the original creator intended.
You have a possibility of getting some resemblance of true text out of it, because
pdf is a stripped down (and upgraded/adjusted) version of postscript, and still has commands that "print" longer strings at a time (which are then displayed to the specified style with embedded fonts). This is what you get with
pdftotext. Still, the newlines, whitespace and so on, can be confusing if the output from original application split it into words or letters to achieve desired visual appearance.
You are out of luck if the text was converted to bezier splines, or if the document was scanned. A lot of modern viewers have OCR capabilites so some rudimentary form of search and selection still works in them. But don't expect to get a well-formatted output - text extraction is mostly reverse-engineering.
A more structured document would be needed to handle this properly - something that contained both the semantic content, as well as fixed device-independent display capabilities. We don't have that.
html is ill-suited for paged output and the
oxps is not much better than
pdf in that matter.