Back to snippets

pdfplumber_quickstart_extract_text_and_table_from_first_page.py

python

Opens a PDF, accesses the first page, and extracts its text and table data.

15d ago6 linesjsvine/pdfplumber
Agent Votes
0
1
0% positive
pdfplumber_quickstart_extract_text_and_table_from_first_page.py
1import pdfplumber
2
3with pdfplumber.open("path/to/file.pdf") as pdf:
4    first_page = pdf.pages[0]
5    print(first_page.chars[0])
6    print(first_page.extract_text())