Skip to content

Commit

Permalink
fix(pdf_creater): correct resource ID retrieval for fonts
Browse files Browse the repository at this point in the history
- update xref_get_key call to use page_xref_id instead of hardcoded value
- ensure dynamic and accurate font list generation
  • Loading branch information
awwaawwa committed Jan 15, 2025
1 parent 2eb54c5 commit b3294d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion yadt/document_il/backend/pdf_creater.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def add_font(self, doc_zh: pymupdf.Document, il: il_version_1.Document):

def get_available_font_list(self, pdf,page):
page_xref_id = pdf[page.page_number].xref
_, r_id = pdf.xref_get_key(288, 'Resources')
_, r_id = pdf.xref_get_key(page_xref_id, 'Resources')
r_id = int(r_id.split(' ')[0])
_, font_dict = pdf.xref_get_key(r_id, 'Font')
fonts = re.findall('/([^ ]+?) ', font_dict)
Expand Down

0 comments on commit b3294d9

Please sign in to comment.