fix(ocr): use 1-based page numbers to match frontend PDF viewer

The PDF viewer uses 1-based currentPage (starting at 1) but the OCR
engines produced 0-based pageNumber from enumerate(). Annotations
created by OCR were assigned to page 0, which doesn't exist in the
viewer. Change enumerate() to start=1 in both engines and the
streaming endpoint.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-04-13 10:32:08 +02:00
parent bac67706b9
commit 97e5138934
5 changed files with 15 additions and 15 deletions

View File

@@ -108,7 +108,7 @@ async def run_ocr_stream(request: OcrRequest):
total_blocks = 0
skipped_pages = 0
for page_idx, image in enumerate(images):
for page_idx, image in enumerate(images, start=1):
try:
engine = kraken_engine if use_kraken else surya_engine
blocks = await asyncio.to_thread(