Permalink
Browse files

fix page number debug bits

  • Loading branch information...
1 parent 30849de commit aee18aef47cf4e6b7a1f66b57d05c1d38999b457 @mtigas mtigas committed Jun 14, 2013
Showing with 8 additions and 5 deletions.
  1. +1 −3 webapp/static/js/pdf_view.js
  2. +7 −2 webapp/tabula_debug.rb
@@ -215,9 +215,7 @@ Tabula.PDFView = Backbone.View.extend({
pdf_page_width: $('img#page-' + this.lastQuery.page).data('original-width')
});
- console.log('debugRulings: page ' + this.lastQuery.page);
-
- $.get('/debug/' + this.PDF_ID + '/rulings?q=page=' + this.lastQuery.page,
+ $.get('/debug/' + this.PDF_ID + '/rulings',
lq,
_.bind(function(data) {
$.each(data, _.bind(function(i, ruling) {
View
@@ -89,8 +89,13 @@ class TabulaDebug < Cuba
on ":file_id/rulings" do |file_id|
pdf_path = File.join(TabulaSettings::DOCUMENTS_BASEPATH, file_id)
+ page = req.params['page'].to_i
+ if page < 1
+ page = 1
+ end
+
rulings = Tabula::LSD.detect_lines_in_pdf_page(File.join(pdf_path, 'document.pdf'),
- req.params['page'].to_i || 1,
+ page,
:image_size => 1024)
rulings = Tabula::Ruling.clean_rulings(rulings)
@@ -103,7 +108,7 @@ class TabulaDebug < Cuba
on 'pdf/:file_id/graph' do |file_id|
pdf_path = File.join(TabulaSettings::DOCUMENTS_BASEPATH, file_id, 'document.pdf')
- extractor = Tabula::Extraction::CharacterExtractor.new(pdf_path, [req.params['page'].to_i || 1])
+ extractor = Tabula::Extraction::CharacterExtractor.new(pdf_path, [page])
text_elements = extractor.extract.next.get_text([req.params['y1'].to_f,
req.params['x1'].to_f,

0 comments on commit aee18ae

Please sign in to comment.