Many file formats these days are actually a folder containing multiple files and folders that are zipped up into a single binary file.
As always when you are mucking around with files like this, create a copy and work only on the copy.
Simply change the file’s extension from .docx, .pptx, or .pdf to .zip. Note: this will not work on the old Office formats .doc and .ppt. In that case, open the file, then save as the new file format (that ends in a x). For PDFs, it's not obvious if it's an older format. You can try saving to a newer version, but sometimes it just doesn't work, unfortunately.
Once you have the zip file, unzip it. On the Mac, the built-in Archive Utility doesn’t always work, so I recommend The Unarchiver app.
For PDFs, all the images show up in the top level of the unzipped folder. For Office documents, it will be under word > media or ppt > media.