Created
May 17, 2018 12:48
-
-
Save mic-kul/12901c232a92b257ff4b4a56b262d363 to your computer and use it in GitHub Desktop.
PDF Textstream
This file contains hidden or 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
def self.file_path_to_text(path) | |
# TODO: exception handling | |
pdfParser = PDFParser.new(RandomAccessFile.new(Java::JavaIo::File.new(path), "r")) | |
pdfParser.parse() | |
pdDocument = PDDocument.new(pdfParser.getDocument()); | |
pdfTextStripper = PDFLayoutTextStripper.new | |
string = pdfTextStripper.getText(pdDocument); | |
return string | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment