-
-
Save janxious/55ac6116b9028ca38fdb to your computer and use it in GitHub Desktop.
pdf-reader
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
class DeployTest < ActiveSupport::TestCase | |
test "large pdf creation" do | |
time_method do | |
response = make_pdf(:document_url => "https://gist.github.com/raw/2a258fb00bc28dabe587/a1dbfa3d1b44f5af4041486454ca51514b402fe2/Moby-Dick,or,The%20Whale.html", | |
:async => true, | |
:strict => "none") | |
pdf_file = download(response) | |
reader = PDF::Reader.new(save_response(pdf_file).path) | |
beginning = reader.pages.take(10).map(&:text).join("\n") | |
assert_match /And God created great whales./, beginning | |
end | |
end | |
end | |
end |
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
#!/usr/bin/env ruby | |
# coding: utf-8 | |
# Extract all text from a single PDF | |
require 'rubygems' | |
require 'pdf/reader' | |
filename = File.expand_path(File.dirname(__FILE__)) + "/../spec/data/cairo-unicode.pdf" | |
PDF::Reader.open(filename) do |reader| | |
reader.pages.each do |page| | |
puts page.text | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/yob/pdf-reader