Browse files

Fix unpaper parameters dependig on the rotation.

This allows properly scanning a5-landscape, rotated pages.
  • Loading branch information...
1 parent 690be69 commit d98bd6586f0c1607dcb56da5386237d5729b3ae5 @Flameeyes committed Mar 3, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 bin/scan2pdf
View
9 bin/scan2pdf
@@ -338,13 +338,19 @@ if not options[:size] =~ /([0-9]+(\.[0-9]+)?)x([0-9]+(\.[0-9]+)?)/
puterror 6, "invalid size requested"
end
+rotation = options[:rotate].to_i % 360
+
case options[:layout]
when 'single'
scan_width = $1.to_f
scan_height = $3.to_f
unpaper_params << "--layout" << "single"
- unpaper_params << "--size" << "#{scan_width.to_i}mm,#{scan_height.to_i}mm"
+ if rotation % 90 != 0
+ unpaper_params << "--size" << "#{scan_width.to_i}mm,#{scan_height.to_i}mm"
+ else
+ unpaper_params << "--size" << "#{scan_height.to_i}mm,#{scan_width.to_i}mm"
+ end
when 'double', 'double-folded'
page_width = $1.to_f
page_height = $3.to_f
@@ -456,7 +462,6 @@ end
scanned_pages = Dir["raw*"]
-rotation = options[:rotate].to_i % 360
double_layout = (options[:layout] =~ /^double(-folded)?/) != nil
scanned_pages.each do |page|

0 comments on commit d98bd65

Please sign in to comment.