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 fd27129b10 - Show all commits

View file

@ -7150,7 +7150,7 @@ 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 = tmp_path_factory.mktemp("return_engine_doc") / "normal.jpg.pdf" outputf = tmp_path_factory.mktemp("return_engine_doc") / "normal.jpg.pdf"
pdf_wrapper = img2pdf.convert_to_docobject(inputf, engine=img2pdf.Engine.pikepdf) pdf_wrapper = img2pdf.convert_to_docobject(inputf, engine=img2pdf.Engine.pikepdf)
pdf = pdf.writer pdf = pdf_wrapper.writer
assert isinstance(pdf, pikepdf.Pdf) assert isinstance(pdf, pikepdf.Pdf)
pdf.save(outputf, min_version=pdf_wrapper.output_version, linearize=True) pdf.save(outputf, min_version=pdf_wrapper.output_version, linearize=True)
assert os.path.isfile(outputf) assert os.path.isfile(outputf)