added type hint
This commit is contained in:
parent
86f2abc553
commit
f18e183ab0
@ -194,10 +194,10 @@ def pdf_stream(pdf: fpdf.fpdf.FPDF):
|
|||||||
return pdf.output(dest="S").encode("latin1")
|
return pdf.output(dest="S").encode("latin1")
|
||||||
|
|
||||||
|
|
||||||
def add_image_to_last_page(pdf, image_metadata_pair):
|
def add_image_to_last_page(pdf: fpdf.fpdf.FPDF, image_metadata_pair):
|
||||||
image, metadata = image_metadata_pair
|
image, metadata = image_metadata_pair
|
||||||
x, y, w, h = itemgetter("x1", "y1", "width", "height")(metadata)
|
x, y, w, h = itemgetter("x1", "y1", "width", "height")(metadata)
|
||||||
|
|
||||||
with tempfile.NamedTemporaryFile(suffix=".png") as temp_image:
|
with tempfile.NamedTemporaryFile(suffix=".png") as temp_image:
|
||||||
image.save(temp_image.name)
|
image.save(temp_image.name)
|
||||||
pdf.image(temp_image.name, x=x, y=y, w=w, h=h)
|
pdf.image(temp_image.name, x=x, y=y, w=w, h=h, type="png")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user