Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pdfly/up2.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ def main(pdf: Path, output: Path) -> None:
lhs.merge_translated_page(
rhs, tx=float(lhs.mediabox.width), ty=0, expand=True
)
# Lucas: expand=True triggers a mediabox size update in PageObject._expand_mediabox(),
# but sometimes the cropbox is also update in the process, sometimes it doesn't.
# I haven't investigated why, but maybe because those attributes are properties
# created with _create_rectangle_accessor().
# Anyway, for now I prefer to ensure that the cropbox matches the mediabox:
lhs.cropbox = lhs.mediabox
writer.add_page(lhs)
sys.stdout.flush()

with open(output, "wb") as fp:
writer.write(fp)
print(f"{output} was created")
Loading