Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PDF Textstream
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
You can’t perform that action at this time.