Communitygithub.com

bg-szy/TOP-SKILLS

Utilisez cette compétence dès que l'utilisateur souhaite effectuer une opération sur des fichiers PDF : lecture, extraction de texte/tableaux, fusion, division, rotation, ajout de filigrane, création de PDF, remplissage de formulaires, chiffrement/déchiffrement, extraction d'images ou OCR sur des PDF scannés.

Qu'est-ce que TOP-SKILLS ?

Cette compétence fournit un guide complet pour le traitement de fichiers PDF en utilisant à la fois des bibliothèques Python (pypdf, pdfplumber, reportlab) et des outils en ligne de commande (pdftotext, qpdf, pdftk). Elle est conçue pour les développeurs et les utilisateurs d'agents IA comme Claude Code ou Cursor, leur permettant de réaliser rapidement des opérations courantes telles que la fusion, la division, l'extraction de texte et de tableaux, la rotation de pages, l'ajout de filigrane, la création de nouveaux PDF, l'OCR sur des documents scannés, et la gestion des mots de passe et des formulaires. La compétence met l'accent sur des exemples clairs et prêts à l'emploi, avec des conseils pratiques comme l'évitement des caractères Unicode pour les exposants/indices dans ReportLab. Elle renvoie également vers des fichiers complémentaires (REFERENCE.md, FORMS.md) pour des cas d'usage avancés ou spécifiques. En suivant ce guide, un agent IA peut traiter des PDF de manière fiable et efficace, en choisissant l'outil le mieux adapté à chaque tâche.

Compatible avec~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/bg-szy/TOP-SKILLS/tree/HEAD/skills/skills/pdf

Demander à votre IA préférée

Ouvre une nouvelle conversation avec cette compétence d'agent déjà préchargée.

Documentation

Guide de Traitement PDF

Aperçu

Ce guide couvre les opérations essentielles de traitement PDF à l'aide de bibliothèques Python et d'outils en ligne de commande. Pour les fonctionnalités avancées, les bibliothèques JavaScript et des exemples détaillés, consultez REFERENCE.md. Si vous devez remplir un formulaire PDF, lisez FORMS.md et suivez ses instructions.

Démarrage Rapide

from pypdf import PdfReader, PdfWriter

# Lire un PDF
reader = PdfReader("document.pdf")
print(f"Pages : {len(reader.pages)}")

# Extraire le texte
text = ""
for page in reader.pages:
    text += page.extract_text()

Bibliothèques Python

pypdf - Opérations de Base

Fusionner des PDF

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)

Diviser un PDF

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)

Extraire les Métadonnées

reader = PdfReader("document.pdf")
meta = reader.metadata
print(f"Titre : {meta.title}")
print(f"Auteur : {meta.author}")
print(f"Sujet : {meta.subject}")
print(f"Créateur : {meta.creator}")

Faire Pivoter des Pages

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

page = reader.pages[0]
page.rotate(90)  # Rotation de 90 degrés dans le sens horaire
writer.add_page(page)

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

pdfplumber - Extraction de Texte et de Tableaux

Extraire du Texte avec Mise en Page

import pdfplumber

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

Extraire des Tableaux

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"Tableau {j+1} à la page {i+1} :")
            for row in table:
                print(row)

Extraction Avancée de Tableaux

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:  # Vérifier si le tableau n'est pas vide
                df = pd.DataFrame(table[1:], columns=table[0])
                all_tables.append(df)

# Combiner tous les tableaux
if all_tables:
    combined_df = pd.concat(all_tables, ignore_index=True)
    combined_df.to_excel("extracted_tables.xlsx", index=False)

reportlab - Créer des PDF

Création Basique d'un PDF

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

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

# Ajouter du texte
c.drawString(100, height - 100, "Bonjour le Monde !")
c.drawString(100, height - 120, "Ceci est un PDF créé avec reportlab")

# Ajouter une ligne
c.line(100, height - 140, 400, height - 140)

# Sauvegarder
c.save()

Créer un PDF avec Plusieurs Pages

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 = []

# Ajouter du contenu
title = Paragraph("Titre du Rapport", styles['Title'])
story.append(title)
story.append(Spacer(1, 12))

body = Paragraph("Ceci est le corps du rapport. " * 20, styles['Normal'])
story.append(body)
story.append(PageBreak())

# Page 2
story.append(Paragraph("Page 2", styles['Heading1']))
story.append(Paragraph("Contenu de la page 2", styles['Normal']))

# Construire le PDF
doc.build(story)

Indices et Exposants

IMPORTANT : N'utilisez jamais les caractères Unicode d'indice/exposant (₀₁₂₃₄₅₆₇₈₉, ⁰¹²³⁴⁵⁶⁷⁸⁹) dans les PDF ReportLab. Les polices intégrées ne contiennent pas ces glyphes, ce qui les fait s'afficher comme des carrés noirs pleins.

Utilisez plutôt les balises XML de ReportLab dans les objets Paragraph :

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

styles = getSampleStyleSheet()

# Indices : utiliser la balise <sub>
chemical = Paragraph("H<sub>2</sub>O", styles['Normal'])

# Exposants : utiliser la balise <super>
squared = Paragraph("x<super>2</super> + y<super>2</super>", styles['Normal'])

Pour le texte dessiné via canvas (pas les objets Paragraph), ajustez manuellement la taille et la position de la police plutôt que d'utiliser des caractères Unicode d'indice/exposant.

Outils en Ligne de Commande

pdftotext (poppler-utils)

# Extraire le texte
pdftotext input.pdf output.txt

# Extraire le texte en conservant la mise en page
pdftotext -layout input.pdf output.txt

# Extraire des pages spécifiques
pdftotext -f 1 -l 5 input.pdf output.txt  # Pages 1-5

qpdf

# Fusionner des PDF
qpdf --empty --pages file1.pdf file2.pdf -- merged.pdf

# Diviser les pages
qpdf input.pdf --pages . 1-5 -- pages1-5.pdf
qpdf input.pdf --pages . 6-10 -- pages6-10.pdf

# Faire pivoter des pages
qpdf input.pdf output.pdf --rotate=+90:1  # Rotation de la page 1 de 90 degrés

# Supprimer un mot de passe
qpdf --password=mypassword --decrypt encrypted.pdf decrypted.pdf

pdftk (si disponible)

# Fusionner
pdftk file1.pdf file2.pdf cat output merged.pdf

# Diviser
pdftk input.pdf burst

# Faire pivoter
pdftk input.pdf rotate 1east output rotated.pdf

Tâches Courantes

Extraire du Texte de PDF Scannés

# Nécessite : pip install pytesseract pdf2image
import pytesseract
from pdf2image import convert_from_path

# Convertir le PDF en images
images = convert_from_path('scanned.pdf')

# OCR de chaque page
text = ""
for i, image in enumerate(images):
    text += f"Page {i+1} :\n"
    text += pytesseract.image_to_string(image)
    text += "\n\n"

print(text)

Ajouter un Filigrane

from pypdf import PdfReader, PdfWriter

# Créer un filigrane (ou charger un existant)
watermark = PdfReader("watermark.pdf").pages[0]

# Appliquer à toutes les pages
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)

Extraire des Images

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

# Cela extrait toutes les images sous les noms output_prefix-000.jpg, output_prefix-001.jpg, etc.

Protection par Mot de Passe

from pypdf import PdfReader, PdfWriter

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

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

# Ajouter un mot de passe
writer.encrypt("userpassword", "ownerpassword")

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

Référence Rapide

TâcheMeilleur OutilCommande/Code
Fusionner des PDFpypdfwriter.add_page(page)
Diviser des PDFpypdfUn fichier par page
Extraire du textepdfplumberpage.extract_text()
Extraire des tableauxpdfplumberpage.extract_tables()
Créer des PDFreportlabCanvas ou Platypus
Fusion en ligne de commandeqpdfqpdf --empty --pages ...
OCR de PDF scannéspytesseractConvertir d'abord en image
Remplir des formulaires PDFpdf-lib ou pypdf (voir FORMS.md)Voir FORMS.md

Prochaines Étapes

  • Pour une utilisation avancée de pypdfium2, consultez REFERENCE.md
  • Pour les bibliothèques JavaScript (pdf-lib), consultez REFERENCE.md
  • Si vous devez remplir un formulaire PDF, suivez les instructions dans FORMS.md
  • Pour des guides de dépannage, consultez REFERENCE.md

Individual skills in this repo

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

bg-szy/TOP-SKILLS

Brand-first landing page designer — runs a brand-identity interview (colors, typography, shape language), then generates and iterates on a polished landing page via Stitch with deployment-ready HTML. Use when the user asks to create, design, or build a landing page, homepage, or marketing page and has no established visual direction. Skip when they have a design mockup, need a dashboard or app UI, are working at component level, building a multi-page app, or restyling with known design tokens — use frontend-design instead.

bg-szy/TOP-SKILLS

Fill out Microsoft Azure Landing Zone (ALZ) Accelerator checklists by interviewing the user, mapping their Azure subscriptions, integrating IP addressing documentation, and applying Microsoft Cloud Adoption Framework best practices. Produces a completed Excel checklist (.xlsx) ready for ALZ deployment. Use this skill whenever the user mentions Azure Landing Zone, ALZ checklist, landing zone accelerator, platform landing zone configuration, ALZ bootstrap, hub-and-spoke setup, Azure network topology planning, or wants to fill out any ALZ-related checklist or configuration file. Also trigger when the user uploads an Excel file that contains tabs like "Accelerator - Bootstrap", "Accelerator - Bicep", or "Accelerator - Terraform".

bg-szy/TOP-SKILLS

Compose a premium, animated landing page section by section in Next.js + Tailwind + Motion (Framer Motion) — built on a real design system, with editorial copy and motion that feels human-crafted, not template-generated. Use when building or rebuilding a landing page, marketing site, or hero/feature/pricing/CTA sections that need to look production-ready and bespoke from day one.

bg-szy/TOP-SKILLS

Write high-converting landing page copy using proven frameworks like PAS (Problem-Agitate-Solution), AIDA, and StoryBrand. Creates headlines, value propositions, CTAs, and full page sections optimized for conversion. Use when users need landing page copy, sales page content, or marketing website text.

bg-szy/TOP-SKILLS

Optimize landing pages for conversions, performance, and SEO. Use when improving landing pages, increasing conversions, or optimizing page performance.

bg-szy/TOP-SKILLS

Review investment portfolios for risk, diversification, fees. Asset allocation recommendations, tax-loss harvesting, rebalancing.

bg-szy/TOP-SKILLS

Beads Viewer - Graph-aware triage engine for Beads projects. Computes PageRank, betweenness, critical path, and cycles. Use --robot-* flags for AI agents.

bg-szy/TOP-SKILLS

CI red? Call us. Pipeline fire brigade deploys. Use when user mentions CI failures, build errors, test failures, or pipeline issues. Do NOT load for: local builds, standard implementation work, reviews, or setup.

bg-szy/TOP-SKILLS

CASS Memory System - procedural memory for AI coding agents. Three-layer cognitive architecture with confidence decay, anti-pattern learning, cross-agent knowledge transfer, trauma guard safety system. Bun/TypeScript CLI.

bg-szy/TOP-SKILLS

Mandatory entry point: read this first for any request to make, create, edit, animate, or render a video, animation, or motion graphic, including a promo, explainer, captioned clip, title card, overlay, slideshow or interactive deck, Remotion port, or any HyperFrames HTML composition. Also use it to inspect, diagnose, validate, preview, publish, or batch-render an existing HyperFrames project. Inputs may be a website URL, GitHub PR, Figma design or URL, text or brief, existing footage, or music. It resumes project state, captures intent when applicable, selects and installs the owning workflow, and routes domain capabilities. HyperFrames is the default output framework unless the user explicitly chooses another framework for the deliverable or asks only to record a browser session.

bg-szy/TOP-SKILLS

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

bg-szy/TOP-SKILLS

Use when the user asks to "pre-launch check the landing page", "run a Quality-Score preflight", or "verify ad-to-page message match before launch"; produces an ad↔page continuity report — message-match gaps, above-the-fold check, page-speed read, form-friction count, mobile-render flags — as a pass/fix punch list. Not for redesigning or rewriting the page — use landing-optimizer; not for scoring the account or the RQS — use ad-account-auditor. 落地页体验预检/广告落地页一致性检查

bg-szy/TOP-SKILLS

Use when the user asks to "optimize our landing page for influencer traffic", "fix our promo-code landing page", or "improve conversion from a creator campaign"; produces a message-match audit, page-structure and social-proof recommendations, a promo-code/CTA conversion plan, and an A/B test roadmap. Not for measuring campaign results after launch — use performance-analyzer.

bg-szy/TOP-SKILLS

Audit a landing page, sales page or checkout page for conversion leaks and return a fix list ordered by expected revenue impact. Use when asked to review, critique or improve a landing page, sales page, opt-in page, product page or checkout flow, when conversion rate is low, when paid traffic is not converting, or when someone asks "why isn't this page converting" or wants a CRO / landing page review.

bg-szy/TOP-SKILLS

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

bg-szy/TOP-SKILLS

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

bg-szy/TOP-SKILLS

Landing page conversion optimization with layout rules, hero section design, and CTA psychology. Covers above-the-fold formula, social proof placement, mobile design, and F-pattern reading. Use for: startup landing pages, product pages, SaaS marketing, conversion optimization. Triggers: landing page, hero section, above the fold, conversion optimization, landing page design, cta button, hero image, landing page layout, saas landing page, product page design, conversion rate, landing page best practices

bg-szy/TOP-SKILLS

Account assets, equity and fund positions, P&L, cash flow records, account statements, margin ratios, buy-power estimates, order management, and DCA recurring investments via Longbridge (most require Trade permission). Frameworks: portfolio diagnosis, rebalancing, asset allocation, risk analysis (VaR/CVaR), performance attribution, and tax-loss harvesting. Triggers: "持仓", "账户", "盈亏", "资产", "对账单", "下单", "买入", "卖出", "撤单", "定投", "组合诊断", "再平衡", "资产配置", "风险分析", "绩效归因", "税损收割", "持倉", "賬戶", "盈虧", "對賬單", "下單", "買入", "賣出", "組合診斷", "再平衡", "稅損收割", "positions", "portfolio", "P&L", "order", "buy", "sell", "DCA", "statement", "risk analysis", "rebalancing", "tax harvesting", "我的风险", "持仓风险", "风险敞口", "資產", "資產配置", "風險分析", "績效歸因", "撤單

bg-szy/TOP-SKILLS

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

bg-szy/TOP-SKILLS

Process video files with audio extraction, format conversion (mp4, webm), and Whisper transcription. Use when user mentions video conversion, audio extraction, transcription, mp4, webm, ffmpeg, or whisper transcription.

Skills associés