First you have to pass the pdf ass a parameter and you have to BodyContentHandler (Create a content handler), FileInputStream ( Create a file input stream
on specified path with the created file), Metadata( Create an object of type Metadata to use),
ParseContext(Create a context parser for the pdf document) PDFParser (PDF document can be parsed using the PDFparser(Printing the contents of the pdf document using toString() method in java)
There is the PDF Parser in the Mendix Marketplace that may do what you need already. It has a GetContent action that sounds appropriate.
If it doesn’t do what you need, the developer has placed the code in GitHub and you could base your own Java Action on their code.
Hope this helps