A PDF parser conforming as much as possible to the PDF specification from Adobe
open sourceMITself-hostablefree
PDF::Reader is a Ruby library that parses PDF files and gives programmatic access to what's inside: document info and metadata, page count, bookmarks, each page's text, and the raw objects and content streams for anything else. It's a low-level foundation for higher-level tools, not a renderer, with text extraction as the main convenience. It follows the PDF 1.7 specification as far as it can and asks for files that break it.
Problems it solves
- extract the text from each page of a PDF in Ruby
- read a PDF's page count and metadata in my Rails app
- check that a PDF we generated contains the right text in a test
- walk the raw objects of a PDF to find out why it's broken
- read the content stream of a page to find where text is drawn
- parse a PDF in pure Ruby without installing poppler
Features
- text extraction per page
- metadata, info and page count
- bookmarks
- raw object access
- content stream callbacks
- IO streams or files
Alternatives
The same job
These do what pdf-reader does.
- HexaPDF Versatile PDF creation and manipulation for Ruby
- pdfplumber Plumb a PDF for detailed information about each char, rectangle, line, et cetera — and easily extract text and tables.
- PyMuPDF A high performance Python library for data extraction, analysis, conversion & manipulation of PDF (and other) documents.
- Azure Document Intelligence Extract document text, structure, and fields with AI models
