Extract Fonts from PDF via Python
Contents
[
Hide
]
In case you want to get all fonts from a PDF document, you can use ‘font_utilities.get_all_fonts()’ method provided in Document class. Please check following code snippet in order to get all fonts from an existing PDF document:
import aspose.pdf as apdf
from io import FileIO
from os import path
import json
from aspose.pycore import cast, is_assignable
path_infile = path.join(self.dataDir, infile)
# Open PDF document
document = apdf.Document(path_infile)
fonts = document.font_utilities.get_all_fonts()
for font in fonts:
print(font.font_name)