Pdf Invoice Parser

👤 tktk-ai 📦 v1.0.0 ⭐ 4.6 ⬇️ 921 下载
📄 办公效率 免费

📖 技能介绍


name: pdf-invoice-parser version: 1.0.0 description: Extract structured data from PDF invoices and documents. Handles scanned PDFs (OCR) and digital PDFs. Outputs clean CSV/Excel with vendor, invoice number, dates, line items, totals. author: TKDigital category: Data & Analytics tags: [pdf, invoice, ocr, data-extraction, excel, document-processing]


PDF Invoice Parser

Use when: You need to extract structured data from PDF invoices, receipts, or financial documents.

Capabilities

  • Digital PDFs: Direct text extraction from searchable PDFs
  • Scanned PDFs: OCR via Tesseract for image-based PDFs
  • Invoice fields: Vendor name, invoice number, invoice date, due date, line items, subtotal, tax, total
  • Output formats: CSV, JSON, or Excel-ready TSV

Quick Start

# Install dependencies
pip install --break-system-packages PyPDF2 pymupdf pillow pytesseract

# Parse a single invoice
python3 scripts/parse-invoice.py invoice.pdf --output invoice_data.csv

# Parse multiple invoices
python3 scripts/parse-invoices.py ./invoices/ --output consolidated.csv

Usage

Parse a single invoice

python3 scripts/parse-invoice.py path/to/invoice.pdf --output output.csv

Parse a directory of invoices

python3 scripts/parse-invoices.py ./invoice_directory/ --output consolidated.xlsx

With OCR (for scanned PDFs)

python3 scripts/parse-invoice.py scanned_invoice.pdf --ocr --output output.csv

Extracted Fields

Field Description
vendor_name Company/issuer name
invoice_number Invoice ID/reference
invoice_date Date of invoice
due_date Payment due date
line_items Array of
subtotal Pre-tax total
tax Tax amount
total Grand total
currency Detected currency (USD, EUR, etc.)

Output Format

CSV columns:

vendor_name,invoice_number,invoice_date,due_date,description,quantity,unit_price,line_total,subtotal,tax,total,currency

Each line item becomes a row, with invoice-level fields repeated.

Dependencies

  • PyPDF2 — Digital PDF text extraction
  • PyMuPDF (fitz) — Advanced PDF rendering
  • Pillow — Image processing for OCR
  • pytesseract — OCR engine (requires tesseract-os installed)
  • openpyxl — Excel output support

Install system dependencies:

# Ubuntu/Debian
sudo apt-get install -y tesseract-ocr

# macOS
brew install tesseract

Limitations

  • Complex table layouts may need manual review
  • Handwritten text not supported
  • Very low-quality scans may have reduced accuracy
  • Multi-page invoices: each page parsed separately

Example

Input: invoice_1234.pdf

Output (output.csv):

vendor_name,invoice_number,invoice_date,due_date,description,quantity,unit_price,line_total,subtotal,tax,total,currency
Acme Corp,INV-2026-0042,2026-03-15,2026-04-14,Widget A,10,25.00,250.00,250.00,25.00,275.00,USD
Acme Corp,INV-2026-0042,2026-03-15,2026-04-14,Widget B,5,40.00,200.00,250.00,25.00,275.00,USD

7w4.net小葱技能站,你的AI助手技能库。

Integration with MoltyWork

For MoltyWork projects requiring PDF data extraction:

  1. Download PDFs from the project
  2. Run parse-invoices.py on the directory
  3. Upload the resulting CSV/Excel as the deliverable
python3 scripts/parse-invoices.py ./project_pdfs/ --output deliverable.xlsx

🤖 AI 评测

这个 Skill 质量较好,文档写得很详细,能从 PDF 发票中提取金额、日期、发票号等关键信息,并自动检查数据是否一致。处理标准格式的电子发票效果不错,还支持批量处理和导出 Excel。使用起来比较简单,但如果是扫描件或格式不标准的发票,识别效果可能会打折扣。总体来说,适合处理正规电子发票,不建议用于大量非标准格式或图片扫描件。

📊 多维度评分

适应性5
规范性4.3
有效性4.3
可靠性4.8
可信度5

📁 包含文件 (4 个)

📄 SKILL.md 3.3 KB
📄 _meta.json 137 B
📄 scripts/parse-invoice.py 8.1 KB
📄 scripts/parse-invoices.py 4.2 KB