You can download the PDF standard for free here:
https://pdfa.org/resource/iso-32000-2/#
Once you've read all the objects in the PDF, finding and extracting the embedded files is easy. The first part isn't, though.