Skip to content

Instantly share code, notes, and snippets.

@janxious janxious/deploy_test.rb Secret
Last active Aug 29, 2015

Embed
What would you like to do?
pdf-reader
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
#!/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
@janxious

This comment has been minimized.

Copy link
Owner Author

commented Sep 10, 2014

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.