Created
July 4, 2014 09:39
-
-
Save johnjohndoe/1abd8dd91aa597131998 to your computer and use it in GitHub Desktop.
Digitize tables in PDF to CSV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'tabula' | |
pdf_file_path = "Abschiebungen.pdf" | |
outfilename = "Abschiebungen.csv" | |
out = open(outfilename, 'w') | |
extractor = Tabula::Extraction::ObjectExtractor.new(pdf_file_path, :all ) | |
extractor.extract.each do |pdf_page| | |
pdf_page.spreadsheets.each do |spreadsheet| | |
out << spreadsheet.to_csv | |
out << "\n\n" | |
end | |
end | |
out.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment