Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aia-11-hn-mib avatar

Gemini Document Processing

  • 4 installs
  • 1 repo stars
  • Updated November 15, 2025
  • aia-11-hn-mib/mib-mockinterviewaibot

gemini-document-processing is a Claude Code skill that analyzes PDF documents with Google Gemini's native vision to extract text, tables, and structured JSON.

About

gemini-document-processing is a Claude Code skill for extracting text, tables, charts, and structured data from PDF documents using Google Gemini's native vision. A developer uses it to summarize long PDFs, answer questions about document content, or output validated JSON from invoices and forms. It bundles a process-document.py script and supports both Google AI Studio and Vertex AI endpoints.

  • Analyzes PDFs with Google Gemini native vision (up to 1,000 pages)
  • Extracts structured JSON from invoices, resumes, and forms with schema validation
  • Ships a ready-to-use process-document.py script plus AI Studio and Vertex AI setup

Gemini Document Processing by the numbers

  • 4 all-time installs (skills.sh)
  • Ranked #530 of 687 Office & Documents skills by installs in the Skillselion catalog
  • Data as of Jul 28, 2026 (Skillselion catalog sync)
At a glance

gemini-document-processing capabilities & compatibility

Requires a Gemini API key; billed at 258 tokens per PDF page per Google pricing.

Capabilities
pdf parsing · document extraction · structured output · document summarization · document qa
Works with
gcp
Use cases
pdf parsing · data analysis · documentation
Pricing
Bring your own API key
From the docs

What gemini-document-processing says it does

Only PDFs get vision processing (TXT, HTML, Markdown are text-only)
SKILL.md
npx skills add https://github.com/aia-11-hn-mib/mib-mockinterviewaibot --skill gemini-document-processing

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs4
repo stars1
Last updatedNovember 15, 2025
Repositoryaia-11-hn-mib/mib-mockinterviewaibot

What it does

Extract structured data and summaries from PDF documents using Gemini vision.

Who is it for?

Extracting structured data from PDFs like invoices, resumes, and forms, or summarizing long reports.

Skip if: TXT, HTML, and Markdown files, which the docs note are processed as text-only without vision.

When should I use this skill?

Processing PDFs, extracting structured data, summarizing documents, or answering questions about document content.

What you get

PDFs are turned into summaries, answers, or schema-validated JSON via Gemini vision.

By the numbers

  • PDFs up to 1,000 pages
  • 258 tokens per page
  • inline encoding under 20MB, File API above

Files

SKILL.mdMarkdownGitHub ↗

Gemini Document Processing

Process and analyze PDF documents using Google Gemini's native vision capabilities. Extract structured information, summarize content, answer questions, and understand complex documents with text, images, diagrams, charts, and tables.

Core Capabilities

  • PDF Vision Processing: Native understanding of PDFs up to 1,000 pages (258 tokens/page)
  • Multimodal Analysis: Process text, images, diagrams, charts, and tables
  • Structured Extraction: Output to JSON with schema validation
  • Document Q&A: Answer questions based on document content
  • Summarization: Generate summaries preserving context
  • Format Conversion: Transcribe to HTML while preserving layout

When to Use This Skill

Use this skill when you need to:

  • Extract structured data from PDF documents (invoices, resumes, forms)
  • Summarize long documents or reports
  • Answer questions about PDF content
  • Analyze documents with complex layouts, charts, or diagrams
  • Convert PDFs to structured formats (JSON, HTML)
  • Process multiple documents in batch
  • Build document processing pipelines

Quick Setup

1. API Key Configuration

The skill supports both Google AI Studio and Vertex AI endpoints.

Option 1: Google AI Studio (Default)

The skill checks for GEMINI_API_KEY in this priority order: 1. Process environment variable 2. Project root .env 3. .claude/.env 4. .claude/skills/.env 5. .env file in skill directory (.claude/skills/gemini-document-processing/.env)

Get your API key: https://aistudio.google.com/apikey

Environment Variable (Recommended)

export GEMINI_API_KEY="your-api-key-here"

Or in .env file:

echo "GEMINI_API_KEY=your-api-key-here" > .env
Option 2: Vertex AI

To use Vertex AI instead:

# Enable Vertex AI
export GEMINI_USE_VERTEX=true
export VERTEX_PROJECT_ID=your-gcp-project-id
export VERTEX_LOCATION=us-central1  # Optional, defaults to us-central1

Or in .env file:

GEMINI_USE_VERTEX=true
VERTEX_PROJECT_ID=your-gcp-project-id
VERTEX_LOCATION=us-central1

2. Install Dependencies

pip install google-genai python-dotenv

Common Use Cases

1. Extract Structured Data from PDF

# Use the provided script
python .claude/skills/gemini-document-processing/scripts/process-document.py \
  --file invoice.pdf \
  --prompt "Extract invoice details as JSON" \
  --format json

2. Summarize Long Document

# Process and summarize
python .claude/skills/gemini-document-processing/scripts/process-document.py \
  --file report.pdf \
  --prompt "Provide a concise executive summary"

3. Answer Questions About Document

# Q&A on document content
python .claude/skills/gemini-document-processing/scripts/process-document.py \
  --file contract.pdf \
  --prompt "What are the key terms and conditions?"

4. Process with Python SDK

from google import genai

client = genai.Client()

# Read PDF
with open('document.pdf', 'rb') as f:
    pdf_data = f.read()

# Process document
response = client.models.generate_content(
    model='gemini-2.5-flash',
    contents=[
        'Extract key information from this document',
        genai.types.Part.from_bytes(
            data=pdf_data,
            mime_type='application/pdf'
        )
    ]
)

print(response.text)

5. Structured Output with JSON Schema

from google import genai
from pydantic import BaseModel

class InvoiceData(BaseModel):
    invoice_number: str
    date: str
    total: float
    vendor: str

client = genai.Client()

response = client.models.generate_content(
    model='gemini-2.5-flash',
    contents=[
        'Extract invoice details',
        genai.types.Part.from_bytes(
            data=open('invoice.pdf', 'rb').read(),
            mime_type='application/pdf'
        )
    ],
    config=genai.types.GenerateContentConfig(
        response_mime_type='application/json',
        response_schema=InvoiceData
    )
)

invoice_data = InvoiceData.model_validate_json(response.text)

Key Constraints

  • Format: Only PDFs get vision processing (TXT, HTML, Markdown are text-only)
  • Size: < 20MB use inline encoding, > 20MB use File API
  • Pages: Max 1,000 pages per document
  • Storage: File API stores for 48 hours only
  • Cost: 258 tokens per page (fixed, regardless of content density)

Performance Tips

1. Use Inline Encoding for PDFs < 20MB (simpler, single request) 2. Use File API for larger files or repeated queries (enables context caching) 3. Place Prompt After PDF for single-page documents 4. Use Context Caching when querying same PDF multiple times 5. Process in Parallel for multiple independent documents 6. Use gemini-2.5-flash for best price/performance ratio

Decision Guide

PDF < 20MB?
├─ Yes → Use inline base64 encoding
└─ No  → Use File API

Need structured JSON output?
├─ Yes → Define response_schema with Pydantic
└─ No  → Get text response

Multiple queries on same PDF?
├─ Yes → Use File API + Context Caching
└─ No  → Inline encoding is sufficient

Script Reference

The skill includes a ready-to-use processing script:

# Basic usage
python scripts/process-document.py --file document.pdf --prompt "Your prompt"

# With JSON output
python scripts/process-document.py --file document.pdf --prompt "Extract data" --format json

# With File API (for large files)
python scripts/process-document.py --file large-document.pdf --prompt "Summarize" --use-file-api

# Multiple prompts
python scripts/process-document.py --file document.pdf --prompt "Question 1" --prompt "Question 2"

References

For comprehensive documentation, see:

  • references/gemini-document-processing-report.md - Complete API reference
  • references/quick-reference.md - Quick lookup guide
  • references/code-examples.md - Additional code patterns

Troubleshooting

API Key Not Found:

# Check API key is set
./scripts/check-api-key.sh

File Too Large:

  • Use File API for files > 20MB
  • Add --use-file-api flag to the script

Vision Not Working:

  • Ensure file is PDF format
  • Other formats (TXT, HTML) don't support vision processing

Support

  • API Documentation: https://ai.google.dev/gemini-api/docs/document-processing
  • Get API Key: https://aistudio.google.com/apikey
  • Model Info: https://ai.google.dev/gemini-api/docs/models/gemini

Related skills

FAQ

How many pages can Gemini process per document?

The docs state native understanding of PDFs up to 1,000 pages at 258 tokens per page.

Do I need a Google API key?

Yes, it requires a GEMINI_API_KEY from Google AI Studio, or Vertex AI credentials as an alternative.

Can it output structured JSON?

Yes, it supports structured output with a Pydantic response_schema for validated JSON.

Office & Documentsllmautomation

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.