Skip to content

Commit

Permalink
tweaks to deal with changes in the pdfbox 2.0 version of tabula-java
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremybmerrill committed Apr 14, 2017
1 parent a356a6c commit b340017
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Binary file not shown.
7 changes: 6 additions & 1 deletion lib/tabula_java_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ module Extraction

def Extraction.openPDF(pdf_filename, password='')
raise Errno::ENOENT unless File.exists?(pdf_filename)
document = PDDocument.load(pdf_filename)
document = PDDocument.load(java.io.File.new(pdf_filename))
#document = PDDocument.loadNonSeq(java.io.File.new(pdf_filename), nil, password)
document
end

class ObjectExtractor < Java::TechnologyTabula.ObjectExtractor
field_accessor :pdfDocument

alias_method :close!, :close

Expand All @@ -85,6 +86,10 @@ def initialize(pdf_filename, pages=[1], password='', options={})

super(document)
end

def page_count
self.pdfDocument.get_number_of_pages
end
end

class PagesInfoExtractor < ObjectExtractor
Expand Down
2 changes: 1 addition & 1 deletion webapp/tabula_web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
require 'fileutils'
require 'securerandom'

require_relative '../lib/jars/tabula-0.9.2-jar-with-dependencies.jar'
require_relative '../lib/jars/tabula-1.0.0-SNAPSHOT-jar-with-dependencies.jar'

require_relative '../lib/tabula_java_wrapper.rb'
java_import 'java.io.ByteArrayOutputStream'
Expand Down

0 comments on commit b340017

Please sign in to comment.