Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.
Author
Category
Document ProcessingInstall
Download and extract to your skills directory
Copy command and send to AI Agent for auto-install:
PDF Processing Skills – Python Document Automation Toolkit
Skill Overview
PDF Processing Skills is a comprehensive set of Python document manipulation tools for extracting text and tabular data from PDFs, creating new documents, merging and splitting files, and handling form filling tasks, helping users automate document processing.
Applicable Scenarios
Core Functions
Frequently Asked Questions
How can I extract table data from a PDF into Excel?
The pdfplumber library can identify table structures in PDFs and extract their data. Example code:
import pdfplumber
import pandas as pd
with pdfplumber.open("document.pdf") as pdf:
all_tables = []
for page in pdf.pages:
tables = page.extract_tables()
for table in tables:
if table:
df = pd.DataFrame(table[1:], columns=table[0])
all_tables.append(df)
if all_tables:
combined_df = pd.concat(all_tables, ignore_index=True)
combined_df.to_excel("extracted_tables.xlsx", index=False)Which Python library is best for processing PDFs?
Different libraries are suitable for different tasks:
Most tasks can be completed by combining these libraries. The specific choice depends on your requirements and development environment.
How can I merge multiple PDF files in batches?
You can easily merge multiple PDFs using pypdf:
from pypdf import PdfWriter, PdfReader
writer = PdfWriter()
for pdf_file in ["doc1.pdf", "doc2.pdf", "doc3.pdf"]:
reader = PdfReader(pdf_file)
for page in reader.pages:
writer.add_page(page)
with open("merged.pdf", "wb") as output:
writer.write(output)For batch processing via the command line, you can use qpdf:
qpdf --empty --pages file1.pdf file2.pdf -- merged.pdfHow can I extract text from a scanned PDF?
A scanned PDF consists of images, so it must first be converted into images and then processed using OCR:
import pytesseract
from pdf2image import convert_from_path
images = convert_from_path('scanned.pdf')
text = ""
for i, image in enumerate(images):
text += f"Page {i+1}:\n"
text += pytesseract.image_to_string(image)
text += "\n\n"This requires the Tesseract OCR engine and the pdf2image library. Recognition accuracy depends on the quality of the document and the clarity of the text.
Can PDF processing recognize handwriting?
Standard OCR tools such as Tesseract perform well when recognizing printed text, but have limited ability to recognize individual handwriting. If handwritten content must be recognized, it is recommended to:
Most document processing scenarios, such as invoices, reports, and contracts, involve printed text, for which standard OCR is generally sufficient.