-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
needs-example-codeThe issue needs a minimal and complete (e.g. all imports) example showing the problemThe issue needs a minimal and complete (e.g. all imports) example showing the problemneeds-pdfThe issue needs a PDF file to show the problemThe issue needs a PDF file to show the problemworkflow-text-extractionFrom a users perspective, text extraction is the affected feature/workflowFrom a users perspective, text extraction is the affected feature/workflow
Description
Trying to extract text from page.
Tested in Win11 & Linux container.
pypdf==4.2.0, crypt_provider=('cryptography', '42.0.5'), PIL=none
Traceback
File "/usr/local/lib/python3.10/site-packages/pypdf/_page.py", line 2052, in extract_text
return self._layout_mode_text(
File "/usr/local/lib/python3.10/site-packages/pypdf/_page.py", line 1950, in _layout_mode_text
fonts = self._layout_mode_fonts()
File "/usr/local/lib/python3.10/site-packages/pypdf/_page.py", line 1902, in _layout_mode_fonts
*cmap, font_dict_obj = build_char_map(font_name, 200.0, self)
File "/usr/local/lib/python3.10/site-packages/pypdf/_cmap.py", line 33, in build_char_map
font_subtype, font_halfspace, font_encoding, font_map = build_char_map_from_dict(
File "/usr/local/lib/python3.10/site-packages/pypdf/_cmap.py", line 58, in build_char_map_from_dict
map_dict, space_code, int_entry = parse_to_unicode(ft, space_code)
File "/usr/local/lib/python3.10/site-packages/pypdf/_cmap.py", line 235, in parse_to_unicode
cm = prepare_cm(ft)
File "/usr/local/lib/python3.10/site-packages/pypdf/_cmap.py", line 260, in prepare_cm
if isinstance(cm, str):
UnboundLocalError: local variable 'cm' referenced before assignment
naktinis
Metadata
Metadata
Assignees
Labels
needs-example-codeThe issue needs a minimal and complete (e.g. all imports) example showing the problemThe issue needs a minimal and complete (e.g. all imports) example showing the problemneeds-pdfThe issue needs a PDF file to show the problemThe issue needs a PDF file to show the problemworkflow-text-extractionFrom a users perspective, text extraction is the affected feature/workflowFrom a users perspective, text extraction is the affected feature/workflow