If it doesn't have to be Pascal native implementation, you can try with MuPDF.
There was even some Lazarus wrapper/binding done by Blestan (the user of this forum):
https://github.com/blestan/lazmupdfNote that this wrapper is outdated a bit.
I'm not sure if the text functions were included into the Pascal wrapper/binding.
I've successfully made some POC based on that few months ago.
However, my POC thingy was PDF rendering, not text extracting.
But I know that text extracting is possible with MuPDF.