Basics

The core building blocks: opening documents, reading text with per-character metadata, vector geometry, images, annotations, and page rendering.

Every guide works against a downloadable sample PDF, and every code block is runnable as-is — outputs shown are real:

Sample Used by Contents
example.pdf Documents, Images, Annotations, Rendering Invoice: logo image, ruled table, link annotation, metadata
text.pdf Text & characters Two pages of structured text, mixed fonts
table.pdf Vector paths, Tables Page 1: ruled table. Page 2: borderless columns
form.pdf Forms guides AcroForm fields + prestamped Courier data

All samples are synthetic (generated by benchmark/generate_pdfs.rb in the repository) and contain only placeholder data.

require "rpdfium"

Rpdfium.open("example.pdf") do |doc|
  page = doc.page(0)
  # ...
end

Table of contents