Skip to content

Commit

Permalink
Fix unpaper parameters dependig on the rotation.
Browse files Browse the repository at this point in the history
This allows properly scanning a5-landscape, rotated pages.
  • Loading branch information
Flameeyes committed Mar 3, 2012
1 parent 690be69 commit d98bd65
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/scan2pdf
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -338,13 +338,19 @@ if not options[:size] =~ /([0-9]+(\.[0-9]+)?)x([0-9]+(\.[0-9]+)?)/
puterror 6, "invalid size requested" puterror 6, "invalid size requested"
end end


rotation = options[:rotate].to_i % 360

case options[:layout] case options[:layout]
when 'single' when 'single'
scan_width = $1.to_f scan_width = $1.to_f
scan_height = $3.to_f scan_height = $3.to_f


unpaper_params << "--layout" << "single" 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' when 'double', 'double-folded'
page_width = $1.to_f page_width = $1.to_f
page_height = $3.to_f page_height = $3.to_f
Expand Down Expand Up @@ -456,7 +462,6 @@ end


scanned_pages = Dir["raw*"] scanned_pages = Dir["raw*"]


rotation = options[:rotate].to_i % 360
double_layout = (options[:layout] =~ /^double(-folded)?/) != nil double_layout = (options[:layout] =~ /^double(-folded)?/) != nil


scanned_pages.each do |page| scanned_pages.each do |page|
Expand Down

0 comments on commit d98bd65

Please sign in to comment.