Extracting fonts from a PDF or PS

Good Evening guys,

Does anyone know of a way to programmatically extract a font (disregarding the type of font) , from a PDF or PostScript file?

Thanks!