1
0
Fork 0
forked from josch/plakativ

slurp in the whole file from stdin because we might need to read it multiple times and mupdf needs to seek in it anyways

This commit is contained in:
Johannes 'josch' Schauer 2020-09-26 19:20:27 +02:00
parent 34213ae2a5
commit 2c111d9936
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -1951,6 +1951,12 @@ def compute_layout(
poster_border=False, poster_border=False,
): ):
doc = None doc = None
if hasattr(infile, "read"):
# we have to slurp in the whole file because we potentially read it
# in multiple times in case img2pdf is installed
# also, mupdf needs to be able to seek(), so we need to slurp it in
# anyways
infile = BytesIO(infile.read())
if have_img2pdf: if have_img2pdf:
# if we have img2pdf available we can encapsulate a raster image # if we have img2pdf available we can encapsulate a raster image
# into a PDF container # into a PDF container