convert(): add option to get engine document (e.g. pikepdf.Pdf) #203

Open
mara0004 wants to merge 7 commits from mara0004/img2pdf:return_engine_doc into main
Showing only changes of commit 316629fa40 - Show all commits

View file

@ -7146,11 +7146,9 @@ def test_general(general_input, engine):
pass pass
def test_return_engine_doc(): def test_return_engine_doc(tmp_path_factory):
inputf = os.path.join(os.path.dirname(__file__), "tests", "input", "normal.jpg") inputf = os.path.join(os.path.dirname(__file__), "tests", "input", "normal.jpg")
outputf = os.path.join( outputf = tmp_path_factory.mktemp("return_engine_doc") / "normal.jpg.pdf"
os.path.dirname(__file__), "tests", "output", "engine_normal.jpg.pdf"
)
pdf, min_version = img2pdf.convert(inputf, return_engine_doc=True, engine=img2pdf.Engine.pikepdf) pdf, min_version = img2pdf.convert(inputf, return_engine_doc=True, engine=img2pdf.Engine.pikepdf)
assert isinstance(pdf, pikepdf.Pdf) assert isinstance(pdf, pikepdf.Pdf)
pdf.save(outputf, min_version=min_version, linearize=True) pdf.save(outputf, min_version=min_version, linearize=True)