Use the convert argument '-define "pdf:use-cropbox=true"' when creating thumbnails. That way cropboxes, if present, gets respected for thumbnail generation.
This commit is contained in:
parent
88ae60a4a0
commit
21818010b9
@ -290,6 +290,7 @@ class Command(BaseCommand):
|
|||||||
strip=True,
|
strip=True,
|
||||||
trim=False,
|
trim=False,
|
||||||
auto_orient=True,
|
auto_orient=True,
|
||||||
|
define="pdf:use-cropbox=true",
|
||||||
input_file=f"{thumbnail_path}[0]",
|
input_file=f"{thumbnail_path}[0]",
|
||||||
output_file=str(document.thumbnail_path),
|
output_file=str(document.thumbnail_path),
|
||||||
)
|
)
|
||||||
|
@ -94,6 +94,8 @@ def move_documents_and_create_thumbnails(apps, schema_editor):
|
|||||||
"500x5000",
|
"500x5000",
|
||||||
"-alpha",
|
"-alpha",
|
||||||
"remove",
|
"remove",
|
||||||
|
"-define",
|
||||||
|
"pdf:use-cropbox=true",
|
||||||
orig_target,
|
orig_target,
|
||||||
os.path.join(thumb_temp, "convert-%04d.png"),
|
os.path.join(thumb_temp, "convert-%04d.png"),
|
||||||
),
|
),
|
||||||
|
@ -27,6 +27,7 @@ def _do_convert(work_package):
|
|||||||
strip=True,
|
strip=True,
|
||||||
trim=False,
|
trim=False,
|
||||||
auto_orient=True,
|
auto_orient=True,
|
||||||
|
define="pdf:use-cropbox=true",
|
||||||
input_file=f"{existing_thumbnail}[0]",
|
input_file=f"{existing_thumbnail}[0]",
|
||||||
output_file=str(converted_thumbnail),
|
output_file=str(converted_thumbnail),
|
||||||
)
|
)
|
||||||
|
@ -53,6 +53,7 @@ def _do_convert(work_package):
|
|||||||
strip=True,
|
strip=True,
|
||||||
trim=False,
|
trim=False,
|
||||||
auto_orient=True,
|
auto_orient=True,
|
||||||
|
define="pdf:use-cropbox=true",
|
||||||
input_file=f"{decrypted_thumbnail}[0]",
|
input_file=f"{decrypted_thumbnail}[0]",
|
||||||
output_file=str(converted_decrypted_thumbnail),
|
output_file=str(converted_decrypted_thumbnail),
|
||||||
)
|
)
|
||||||
|
@ -140,6 +140,7 @@ def run_convert(
|
|||||||
type=None,
|
type=None,
|
||||||
depth=None,
|
depth=None,
|
||||||
auto_orient=False,
|
auto_orient=False,
|
||||||
|
define=None,
|
||||||
extra=None,
|
extra=None,
|
||||||
logging_group=None,
|
logging_group=None,
|
||||||
) -> None:
|
) -> None:
|
||||||
@ -158,6 +159,7 @@ def run_convert(
|
|||||||
args += ["-type", str(type)] if type else []
|
args += ["-type", str(type)] if type else []
|
||||||
args += ["-depth", str(depth)] if depth else []
|
args += ["-depth", str(depth)] if depth else []
|
||||||
args += ["-auto-orient"] if auto_orient else []
|
args += ["-auto-orient"] if auto_orient else []
|
||||||
|
args += ["-define", str(define)] if define else []
|
||||||
args += [input_file, output_file]
|
args += [input_file, output_file]
|
||||||
|
|
||||||
logger.debug("Execute: " + " ".join(args), extra={"group": logging_group})
|
logger.debug("Execute: " + " ".join(args), extra={"group": logging_group})
|
||||||
@ -229,6 +231,7 @@ def make_thumbnail_from_pdf(in_path, temp_dir, logging_group=None) -> str:
|
|||||||
strip=True,
|
strip=True,
|
||||||
trim=False,
|
trim=False,
|
||||||
auto_orient=True,
|
auto_orient=True,
|
||||||
|
define="pdf:use-cropbox=true",
|
||||||
input_file=f"{in_path}[0]",
|
input_file=f"{in_path}[0]",
|
||||||
output_file=out_path,
|
output_file=out_path,
|
||||||
logging_group=logging_group,
|
logging_group=logging_group,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user