Skip to content

Commit

Permalink
Merge pull request #5 from swisstopo/fix/file-name-collision
Browse files Browse the repository at this point in the history
Fix file name collision on API processing
  • Loading branch information
daniel-va authored Oct 29, 2024
2 parents 48867d5 + 48b41d9 commit 2b08046
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ocr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def process_pdf(
confidence_threshold: float,
use_aggressive_strategy: bool,
):
tmp_out_path = os.path.join(tmp_dir, f"output.pdf")
tmp_out_path = os.path.join(tmp_dir, f"output.incremental.pdf")

in_doc = fitz.open(in_path)
out_doc = fitz.open(in_path)
Expand Down Expand Up @@ -93,9 +93,9 @@ def process_pdf(
out_doc.save(tmp_out_path, incremental=True, encryption=PDF_ENCRYPT_KEEP)

out_doc.close()
in_doc.close()
out_doc = fitz.open(tmp_out_path)
out_doc.save(out_path, garbage=3, deflate=True)
in_doc.close()
out_doc.close()

# Verify that we can read the written document, and that it still has the same number of pages. Some corrupt input
Expand Down

0 comments on commit 2b08046

Please sign in to comment.