lib/pdf/reader/page_layout.rb in pdf-reader-2.0.0 vs lib/pdf/reader/page_layout.rb in pdf-reader-2.1.0
- old
+ new
@@ -28,11 +28,11 @@
page = row_count.times.map { |i| " " * col_count }
@runs.each do |run|
x_pos = ((run.x - @x_offset) / col_multiplier).round
y_pos = row_count - (run.y / row_multiplier).round
- if y_pos < row_count && y_pos >= 0 && x_pos < col_count && x_pos >= 0
- local_string_insert(page[y_pos], run.text, x_pos)
+ if y_pos <= row_count && y_pos >= 0 && x_pos <= col_count && x_pos >= 0
+ local_string_insert(page[y_pos-1], run.text, x_pos)
end
end
interesting_rows(page).map(&:rstrip).join("\n")
end