docling-project / docling-project/docling
Convert PDF file error [RuntimeError: Invalid code point]
- Dominant language
- Python
- Stars
- 66.4k
- Forks
- 4.8k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 84
Description
### Bug
After debugging the issue, I determined that the problem originates within the line:
```python
parsed_page = parser.parse_pdf_from_key_on_page(document_hash, page_no)
```
located in docling>backend>docling_parse_v2_backend.py.
- Error Message
```
python3.12/site-packages/docling/backend/docling_parse_v2_backend.py", line 28, in __init__
parsed_page = parser.parse_pdf_from_key_on_page(document_hash, page_no)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Invalid code point
```
- My source code
```python
import logging
import time
from pathlib import Path
from docling_core.types.doc import ImageRefMode, PictureItem, TableItem
from docling.datamodel.base_models import FigureElement, InputFormat, Table
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.document_converter import DocumentConverter, PdfFormatOption
_log = logging.getLogger(__name__)
IMAGE_RESOLUTION_SCALE = 2.0
def load_document(input_source, output_dir):
logging.basicConfig(level=logging.INFO)
input_doc_path = input_source
output_dir = Path(output_dir)
pipeline_options = PdfPipelineOptions()
pipeline_options.images_scale = IMAGE_RESOLUTION_SCALE
pipeline_options.generate_page_images = True
pipeline_options.generate_picture_images = True
doc_converter = DocumentConverter(
format_options={
InputFormat.PDF: PdfFormatOption(pipeline_options=pipeline_options)
}
)
start_time = time.time()
conv_res = doc_converter.convert(input_doc_path)
return conv_res
output_dir = Path("test")
input_source = Path("file_path")
documents = load_document(input_source, output_dir)
```
### Steps to reproduce
Download this file and chage the input source Path(source code above) to attached file
[연말정산.pdf](https://github.com/user-attachments/files/19067937/default.pdf)
### Docling version
2.25.1
### Python version
python 3.12
Contributor guide
Assessment
This issue has not been assessed yet.