Skip to content

Commit

Permalink
Set default processing to no tiling if first page > A3. Closes #189
Browse files Browse the repository at this point in the history
  • Loading branch information
cfcurtis committed Jul 24, 2023
1 parent a470e7c commit 4fb0579
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion pdfstitcher/ui/main_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,16 @@ def load_file(self, pathname, password=""):
# only enable tiling if there are more than one page
if len(self.in_doc.pages) > 1:
self.tiler = PageTiler()
self.io.do_tile.SetValue(1)
self.io.do_tile.Enable()
self.tt.Enable()

# check how big the pages are, and default to no tiling if they're over A3
first_page = self.in_doc.pages[0]
w, h = utils.get_page_dims(first_page, target_user_unit=1)
if w > 11.7 * 72 or h > 16.5 * 72:
self.io.do_tile.SetValue(0)
else:
self.io.do_tile.SetValue(1)
else:
self.io.do_tile.SetValue(0)
self.io.do_tile.Disable()
Expand Down
2 changes: 1 addition & 1 deletion pdfstitcher/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def get_page_dims(
) -> tuple[float, float]:
"""
Helper function to calculate the page dimensions
Returns width, height as observed by the user
Returns width, height in pixels as observed by the user
(taking rotation and UserUnit into account)
"""
# The mediabox is typically specified as
Expand Down

0 comments on commit 4fb0579

Please sign in to comment.