Complex Extraction of Law Enforcement Complaints
This PDF contains a set of complaint records from a local law enforcement agency. Challenges include its relational data structure, unusual formatting common in the region, and redactions that disrupt automatic parsing.
pdf.add_exclusion(lambda page: page.find(text='L.E.A. Data Technologies').below(include_source=True))
pdf.add_exclusion(lambda page: page.find(text='Complaints By Date').above(include_source=True))
page.show(exclusions='black')
View full example →
number = (
section
.find("text:contains(Number)")
.below(until='text', width='element')
)
print("Number is", number.extract_text())
number.show(crop=100)
View full example →
number = (
section
.find("text:contains(Number)")
.below(until='text', width='element')
.find('text', overlap='partial')
)
print("Number is", number.extract_text())
View full example →
Extracting Complex Data from Serbian Regulatory PDF
This PDF contains parts of Serbian policy documents, crucial for a research project analyzing industry policies across countries. The challenge lies in extracting a large table that spans pages (page 90 to 97) and a math formula on page 98, all in Serbian. Both elements lack clear boundaries between pages, complicating extraction.
region = (
pages
.find(text="Tabela 4")
.below(
until="text:contains(Tabela 5)",
include_endpoint=False,
multipage=True
View full example →
Extracting Data Tables from Oklahoma Booze Licensees PDF
This PDF contains detailed tables listing alcohol licensees in Oklahoma. It has multi-line cells making it hard to extract data accurately. Challenges include alternative row colors instead of lines ("zebra stripes"), complicating row differentiation and extraction.
(
page
.find(text="NUMBER")
.below(width='element')
).show(crop=100, width=700)
View full example →
rows = (
page
.find(text="NUMBER")
.below(
width='element',
include_source=True
)
View full example →
Extracting Economic Data from Brazil's Central Bank PDF
This PDF is the weekly “Focus” report from Brazil’s central bank with economic projections and statistics. Challenges include commas instead of decimal points, images showing projection changes, and tables without border lines that merge during extraction.
data = (
page
.find(text='Expectativas')
.below(
until='text:contains(comportamento)',
include_endpoint=False
)
View full example →
row_names = (
data
.find(text='IPCA')
.below(width='element', include_source=True)
.clip(data)
.find_all('text', overlap='partial')
)
View full example →
include_source=True,
include_endpoint=False
)
.below(width='element')
).show()
View full example →
Extracting State Agency Call Center Wait Times from FOIA PDF
This PDF contains data on wait times at a state agency call center. The main focus is on the data on the first two pages, which matches other states' submission formats. The later pages provide granular breakdowns over several years. Challenges include it being heavily pixelated, making it hard to read numbers and text, with inconsistent and unreadable charts.
table_area = (
page
.find('text:contains(Figure)')
.below(
until='text:contains(Please use the comments)',
include_endpoint=False
)
View full example →
ICE Detention Facilities Compliance Report Extraction
This PDF is an ICE report on compliance among detention facilities over the last 20-30 years. Our aim is to extract facility statuses and contract signatories' names and dates. Challenges include strange redactions, blobby text, poor contrast, and ineffective OCR. It has handwritten signatures and dates that are redacted.
portion = (
left_col
.find("text:closest(Name and Location)")
.below(
until='text:contains(ICE Information)',
include_endpoint=False
)
View full example →
with left_col.within() as col:
answer = (
label
.below(until='text', anchor='start')
)
print(answer.extract_text('words'))
View full example →
with left_col.within() as col:
label = left_col.find("text:closest(County)")
answer = label.below(until='text')
print(answer.extract_text('words'))
View full example →
OCR and AI magic
Master OCR techniques with Natural PDF - from basic text recognition to advanced LLM-powered corrections. Learn to extract text from image-based PDFs, handle tables without proper boundaries, and leverage AI for accuracy improvements.
table_area = (
page
.find('text:contains(Violations)')
.below(
until='text:contains(Jungle)',
include_endpoint=False
)
View full example →
Working with page structure
Extract text from complex multi-column layouts while maintaining proper reading order. Learn techniques for handling academic papers, newsletters, and documents with intricate column structures using Natural PDF's layout detection features.
region = (
flow
.find('text:contains("Table one")')
.below(
until='text:contains("Table two")',
include_endpoint=False
)
View full example →
regions = (
flow
.find_all('text[width>10]:bold')
.below(
until='text[width>10]:bold|text:contains("Here is a bit")',
include_endpoint=False
)
View full example →