CommunityCodierung & Entwicklunggithub.com

PDF

Verwenden Sie dieses Skill, wenn der Benutzer etwas mit PDF-Dateien tun möchte, wie Lesen, Bearbeiten, Zusammenführen, Aufteilen, Drehen, Wasserzeichen hinzufügen, Formulare ausfüllen, Verschlüsseln, OCR und mehr.

Was ist PDF?

Dieser Skill ist ein umfassender Leitfaden zur PDF-Verarbeitung mit Python-Bibliotheken und Kommandozeilen-Tools. Er deckt grundlegende und fortgeschrittene Operationen wie Zusammenführen, Aufteilen, Drehen von Seiten, Textextraktion, Tabellenextraktion, Erstellung neuer PDFs, Hinzufügen von Wasserzeichen, Passwortschutz und OCR für gescannte Dokumente ab. Der Skill unterstützt plattformunabhängige Workflows, indem er Tools wie pypdf, pdfplumber und reportlab in Python sowie qpdf und pdftk auf der Kommandozeile bereitstellt. Zusätzlich wird die richtige Handhabung von tief- und hochgestellten Zeichen in Reportlab betont, um Darstellungsfehler zu vermeiden. Für weiterführende Details zu JavaScript-Bibliotheken und Formularausfüllung wird auf separate Referenzdokumente (REFERENCE.md, FORMS.md) verwiesen.

Funktioniert mit~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/anthropics/skills/tree/main/skills/pdf

Installed? Explore more Codierung & Entwicklung skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

Leitfaden zur PDF-Verarbeitung

Überblick

Dieser Leitfaden behandelt wesentliche PDF-Verarbeitungsvorgänge mit Python-Bibliotheken und Kommandozeilen-Tools. Für erweiterte Funktionen, JavaScript-Bibliotheken und detaillierte Beispiele siehe REFERENCE.md. Wenn Sie ein PDF-Formular ausfüllen müssen, lesen Sie FORMS.md und befolgen Sie dessen Anweisungen.

Schnellstart

from pypdf import PdfReader, PdfWriter

# Ein PDF lesen
reader = PdfReader("document.pdf")
print(f"Seiten: {len(reader.pages)}")

# Text extrahieren
text = ""
for page in reader.pages:
    text += page.extract_text()

Python-Bibliotheken

pypdf – Grundlegende Operationen

PDFs zusammenführen

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)

PDF aufteilen

reader = PdfReader("input.pdf")
for i, page in enumerate(reader.pages):
    writer = PdfWriter()
    writer.add_page(page)
    with open(f"page_{i+1}.pdf", "wb") as output:
        writer.write(output)

Metadaten extrahieren

reader = PdfReader("document.pdf")
meta = reader.metadata
print(f"Titel: {meta.title}")
print(f"Autor: {meta.author}")
print(f"Betreff: {meta.subject}")
print(f"Ersteller: {meta.creator}")

Seiten drehen

reader = PdfReader("input.pdf")
writer = PdfWriter()

page = reader.pages[0]
page.rotate(90)  # 90 Grad im Uhrzeigersinn drehen
writer.add_page(page)

with open("rotated.pdf", "wb") as output:
    writer.write(output)

pdfplumber – Text- und Tabellenextraktion

Text mit Layout extrahieren

import pdfplumber

with pdfplumber.open("document.pdf") as pdf:
    for page in pdf.pages:
        text = page.extract_text()
        print(text)

Tabellen extrahieren

with pdfplumber.open("document.pdf") as pdf:
    for i, page in enumerate(pdf.pages):
        tables = page.extract_tables()
        for j, table in enumerate(tables):
            print(f"Tabelle {j+1} auf Seite {i+1}:")
            for row in table:
                print(row)

Erweiterte Tabellenextraktion

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:  # Prüfen, ob Tabelle nicht leer ist
                df = pd.DataFrame(table[1:], columns=table[0])
                all_tables.append(df)

# Alle Tabellen kombinieren
if all_tables:
    combined_df = pd.concat(all_tables, ignore_index=True)
    combined_df.to_excel("extracted_tables.xlsx", index=False)

reportlab – PDFs erstellen

Einfache PDF-Erstellung

from reportlab.lib.pagesizes import letter
from reportlab.pdfgen import canvas

c = canvas.Canvas("hello.pdf", pagesize=letter)
width, height = letter

# Text hinzufügen
c.drawString(100, height - 100, "Hallo Welt!")
c.drawString(100, height - 120, "Dies ist ein PDF, erstellt mit reportlab")

# Eine Linie hinzufügen
c.line(100, height - 140, 400, height - 140)

# Speichern
c.save()

PDF mit mehreren Seiten erstellen

from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, PageBreak
from reportlab.lib.styles import getSampleStyleSheet

doc = SimpleDocTemplate("report.pdf", pagesize=letter)
styles = getSampleStyleSheet()
story = []

# Inhalt hinzufügen
title = Paragraph("Berichtstitel", styles['Title'])
story.append(title)
story.append(Spacer(1, 12))

body = Paragraph("Dies ist der Text des Berichts. " * 20, styles['Normal'])
story.append(body)
story.append(PageBreak())

# Seite 2
story.append(Paragraph("Seite 2", styles['Heading1']))
story.append(Paragraph("Inhalt für Seite 2", styles['Normal']))

# PDF erstellen
doc.build(story)

Tief- und Hochgestellte Zeichen

WICHTIG: Verwenden Sie niemals Unicode-Tief-/Hochstellungszeichen (₀₁₂₃₄₅₆₇₈₉, ⁰¹²³⁴⁵⁶⁷⁸⁹) in ReportLab-PDFs. Die integrierten Schriftarten enthalten diese Glyphen nicht, was dazu führt, dass sie als schwarze Kästchen dargestellt werden.

Verwenden Sie stattdessen die XML-Markup-Tags von ReportLab in Paragraph-Objekten:

from reportlab.platypus import Paragraph
from reportlab.lib.styles import getSampleStyleSheet

styles = getSampleStyleSheet()

# Tiefgestellt: <sub>-Tag verwenden
chemical = Paragraph("H<sub>2</sub>O", styles['Normal'])

# Hochgestellt: <super>-Tag verwenden
squared = Paragraph("x<super>2</super> + y<super>2</super>", styles['Normal'])

Für Canvas-gezeichneten Text (keine Paragraph-Objekte) passen Sie Schriftgröße und -position manuell anstatt Unicode-Tief-/Hochstellungszeichen zu verwenden.

Kommandozeilen-Tools

pdftotext (poppler-utils)

# Text extrahieren
pdftotext input.pdf output.txt

# Text unter Beibehaltung des Layouts extrahieren
pdftotext -layout input.pdf output.txt

# Bestimmte Seiten extrahieren
pdftotext -f 1 -l 5 input.pdf output.txt  # Seiten 1-5

qpdf

# PDFs zusammenführen
qpdf --empty --pages file1.pdf file2.pdf -- merged.pdf

# Seiten aufteilen
qpdf input.pdf --pages . 1-5 -- pages1-5.pdf
qpdf input.pdf --pages . 6-10 -- pages6-10.pdf

# Seiten drehen
qpdf input.pdf output.pdf --rotate=+90:1  # Seite 1 um 90 Grad drehen

# Passwort entfernen
qpdf --password=mypassword --decrypt encrypted.pdf decrypted.pdf

pdftk (falls verfügbar)

# Zusammenführen
pdftk file1.pdf file2.pdf cat output merged.pdf

# Aufteilen
pdftk input.pdf burst

# Drehen
pdftk input.pdf rotate 1east output rotated.pdf

Häufige Aufgaben

Text aus gescannten PDFs extrahieren

# Erfordert: pip install pytesseract pdf2image
import pytesseract
from pdf2image import convert_from_path

# PDF in Bilder umwandeln
images = convert_from_path('scanned.pdf')

# OCR für jede Seite
text = ""
for i, image in enumerate(images):
    text += f"Seite {i+1}:\n"
    text += pytesseract.image_to_string(image)
    text += "\n\n"

print(text)

Wasserzeichen hinzufügen

from pypdf import PdfReader, PdfWriter

# Wasserzeichen erstellen (oder existierendes laden)
watermark = PdfReader("watermark.pdf").pages[0]

# Auf alle Seiten anwenden
reader = PdfReader("document.pdf")
writer = PdfWriter()

for page in reader.pages:
    page.merge_page(watermark)
    writer.add_page(page)

with open("watermarked.pdf", "wb") as output:
    writer.write(output)

Bilder extrahieren

# Mit pdfimages (poppler-utils)
pdfimages -j input.pdf output_prefix

# Dies extrahiert alle Bilder als output_prefix-000.jpg, output_prefix-001.jpg, usw.

Passwortschutz

from pypdf import PdfReader, PdfWriter

reader = PdfReader("input.pdf")
writer = PdfWriter()

for page in reader.pages:
    writer.add_page(page)

# Passwort hinzufügen
writer.encrypt("userpassword", "ownerpassword")

with open("encrypted.pdf", "wb") as output:
    writer.write(output)

Kurzreferenz

AufgabeBestes ToolBefehl/Code
PDFs zusammenführenpypdfwriter.add_page(page)
PDFs aufteilenpypdfEine Seite pro Datei
Text extrahierenpdfplumberpage.extract_text()
Tabellen extrahierenpdfplumberpage.extract_tables()
PDFs erstellenreportlabCanvas oder Platypus
Kommandozeile zusammenführenqpdfqpdf --empty --pages ...
OCR gescannte PDFspytesseractZuerst in Bild konvertieren
PDF-Formulare ausfüllenpdf-lib oder pypdf (siehe FORMS.md)Siehe FORMS.md

Nächste Schritte

  • Für erweiterte pypdfium2-Nutzung siehe REFERENCE.md
  • Für JavaScript-Bibliotheken (pdf-lib) siehe REFERENCE.md
  • Wenn Sie ein PDF-Formular ausfüllen müssen, folgen Sie den Anweisungen in FORMS.md
  • Für Fehlerbehebungsanleitungen siehe REFERENCE.md

Individual skills in this repo

This repo contains 19 individual skills — each has its own dedicated page.

academy-guide

Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content.

algorithmic-art

Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists

anthropics/template-skill

Replace with description of the skill and when Claude should use it.

brand-guidelines

Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.

canvas-design

Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists

claude-api

|-

discernment-nudge

After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals, or emails, estimates or projections, analysis or interpretation of data, factual claims they may rely on, or a multi-step argument — invoke this skill BEFORE finalizing your reply and then, if it applies, append 2-3 short follow-up questions, each tied to something specific in what you just produced, that help the user check key facts, probe the reasoning or assumptions, and notice missing context. Do this at most once per conversation. Skip it when the user asked a trivial how-to or simple lookup, wants a purely educational explanation, asked you only to format, convert, or assemble a file from content they provided, is writing code they will run, is doing creative writing or casual chat, or already asked you to double-check, cite, or review — the skill file explains these boundaries and the exact output format.

doc-coauthoring

Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.

docx

Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of

frontend-design

Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.

internal-comms

A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).

mcp-builder

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

pptx

Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions \

skill-creator

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill

slack-gif-creator

Knowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like

theme-factory

Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with colors/fonts that you can apply to any artifact that has been creating, or can generate a new theme on-the-fly.

webapp-testing

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

web-artifacts-builder

Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.

xlsx

Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like \

Verwandte Skills