26
28

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[Ruby]pdf-readerでPDFからテキスト抽出

Posted at

RubyでPDFのテキスト抽出メモ。pdf-readerが便利でした。
https://github.com/yob/pdf-reader

install

gem install pdf-reader

テキスト抽出

reader = PDF::Reader.new("sample.pdf")

reader.pages.each do |page|
  puts page.text
end

ページ数やメタデータも取れる

puts reader.pdf_version
puts reader.info
puts reader.metadata
puts reader.page_count

カンタン!

26
28
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
28

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?