We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If the font name of a PDF file is unknown, the program will raise a KeyError: <PDFType1Font: basefont='unknown'>, as follows:
KeyError: <PDFType1Font: basefont='unknown'>
Traceback (most recent call last): File "/Users/rey/miniconda3/envs/pdf/bin/pdf2zh", line 8, in <module> sys.exit(main()) ^^^^^^ File "/Users/rey/Developer/PDFMathTranslate.Origin/pdf2zh/pdf2zh.py", line 192, in main translate(**vars(parsed_args)) File "/Users/rey/Developer/PDFMathTranslate.Origin/pdf2zh/high_level.py", line 359, in translate s_mono, s_dual = translate_stream( ^^^^^^^^^^^^^^^^^ File "/Users/rey/Developer/PDFMathTranslate.Origin/pdf2zh/high_level.py", line 234, in translate_stream obj_patch: dict = translate_patch(fp, prompt=kwarg["prompt"], **locals()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/rey/Developer/PDFMathTranslate.Origin/pdf2zh/high_level.py", line 165, in translate_patch interpreter.process_page(page) File "/Users/rey/Developer/PDFMathTranslate.Origin/pdf2zh/pdfinterp.py", line 270, in process_page ops_new = self.device.end_page(page) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/rey/Developer/PDFMathTranslate.Origin/pdf2zh/converter.py", line 61, in end_page return self.receive_layout(self.cur_item) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/rey/Developer/PDFMathTranslate.Origin/pdf2zh/converter.py", line 429, in receive_layout ops += f"/{self.fontid[vch.font]} {vch.size:f} Tf 1 0 0 1 {x + vch.x0 - var[vid][0].x0:f} {fix + y + vch.y0 - var[vid][0].y0:f} Tm [<{raw_string(self.fontid[vch.font], vc)}>] TJ " ~~~~~~~~~~~^^^^^^^^^^ KeyError: <PDFType1Font: basefont='unknown'>
The program itself runs well, passing all tests and translating other documents.
translate.cli.font.unknown.pdf
The text was updated successfully, but these errors were encountered:
A corresponding test case has been written in CI, yet not active before fixing the bug.
Sorry, something went wrong.
No branches or pull requests
Bug
If the font name of a PDF file is unknown, the program will raise a
KeyError: <PDFType1Font: basefont='unknown'>
, as follows:The program itself runs well, passing all tests and translating other documents.
Sample Document
The text was updated successfully, but these errors were encountered: