19 lines
496 B
Python
19 lines
496 B
Python
from __future__ import annotations
|
|
|
|
import pymupdf
|
|
|
|
from orc_renaming.pdf_text import render_first_page
|
|
|
|
|
|
def test_render_first_page_as_jpeg(tmp_path) -> None:
|
|
pdf_path = tmp_path / "sample.pdf"
|
|
document = pymupdf.open()
|
|
page = document.new_page()
|
|
page.insert_text((72, 72), "Rechnung 123")
|
|
document.save(pdf_path)
|
|
document.close()
|
|
|
|
image = render_first_page(pdf_path, dpi=96, image_format="jpeg")
|
|
assert image.startswith(b"\xff\xd8")
|
|
assert len(image) > 1000
|