Remove with pypdfium2_lock from caller sites

Signed-off-by: Christoph Auer <cau@zurich.ibm.com>
This commit is contained in:
Christoph Auer 2025-06-13 16:11:34 +02:00
parent 1c39dc93ab
commit 5ec6de3ae4
2 changed files with 52 additions and 53 deletions

View File

@ -143,7 +143,6 @@ class DoclingParseV2PageBackend(PdfPageBackend):
text_cells = self._compute_text_cells()
# Get the PDF page geometry from pypdfium2
with pypdfium2_lock:
dimension = get_pdf_page_geometry(self._ppage)
# Create SegmentedPdfPage
@ -152,7 +151,7 @@ class DoclingParseV2PageBackend(PdfPageBackend):
textline_cells=text_cells,
char_cells=[],
word_cells=[],
has_lines=len(text_cells) > 0,
has_textlines=len(text_cells) > 0,
has_words=False,
has_chars=False,
)

View File

@ -39,6 +39,7 @@ def get_pdf_page_geometry(
Returns:
PdfPageGeometry with all the different bounding boxes properly set
"""
with pypdfium2_lock:
# Get the main bounding box (intersection of crop_box and media_box)
bbox_tuple = ppage.get_bbox()
bbox = BoundingBox.from_tuple(bbox_tuple, CoordOrigin.BOTTOMLEFT)
@ -285,7 +286,6 @@ class PyPdfiumPageBackend(PdfPageBackend):
text_cells = self._compute_text_cells()
# Get the PDF page geometry from pypdfium2
with pypdfium2_lock:
dimension = get_pdf_page_geometry(self._ppage)
# Create SegmentedPdfPage
@ -294,7 +294,7 @@ class PyPdfiumPageBackend(PdfPageBackend):
textline_cells=text_cells,
char_cells=[],
word_cells=[],
has_lines=len(text_cells) > 0,
has_textlines=len(text_cells) > 0,
has_words=False,
has_chars=False,
)