Communitygithub.com

Anhvu1107/all-agent-skill

PDF 파일 읽기, 추출, 분할, 병합, 회전, 생성, 검증, OCR, 양식 작성 및 수정 등 모든 PDF 관련 작업에 항상 사용합니다.

all-agent-skill란 무엇인가요?

이 스킬은 PDF 파일을 처리하는 모든 작업에 대해 포괄적인 가이드를 제공합니다. pypdf, pdfplumber, reportlab과 같은 Python 라이브러리와 pdftotext, qpdf, pdftk 같은 명령줄 도구를 사용하여 PDF 읽기, 텍스트 및 표 추출, 분할, 병합, 회전, 생성, 워터마크 추가, 암호 보호, OCR 등을 수행하는 방법을 상세히 설명합니다. 스킬의 SKILL.md 문서는 작업 유형에 따라 참조 문서를 선택적으로 읽도록 지시하는 '선택적 읽기 규칙'을 제시하며, AcroForm과 같은 양식 작성 작업에는 별도의 FORMS.md를 참조하도록 안내합니다. 개발자는 이 가이드를 통해 다양한 PDF 처리 요구 사항에 적합한 도구와 코드 예제를 빠르게 찾아 사용할 수 있습니다. 또한 서브스크립트/슈퍼스크립트와 같은 특수 문자 처리에 관한 중요한 주의사항도 포함되어 있습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Anhvu1107/all-agent-skill/tree/HEAD/.agent/skills/pdf

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

PDF 처리 가이드

선택적 읽기 규칙

다음부터 시작하세요:

  • references/usage-routing.md
  • references/quality-checklist.md

그런 다음 사용자의 실제 작업과 일치하는 상속된 문서, 스크립트, 자산 또는 예제만 로드하세요.

선택적 읽기 규칙

다음부터 시작하세요:

  • references/senior-master-standard.md
  • references/task-routing.md
  • references/quality-checklist.md

그런 다음 읽으세요:

  • forms.md (AcroForm 또는 필드 채우기 작업용)
  • reference.md (더 넓은 도구 또는 라이브러리 조사가 필요할 때)

개요

이 가이드는 Python 라이브러리와 명령줄 도구를 사용한 필수 PDF 처리 작업을 다룹니다. 고급 기능, JavaScript 라이브러리 및 자세한 예제는 REFERENCE.md를 참조하세요. PDF 양식을 작성해야 하는 경우 FORMS.md를 읽고 지침을 따르세요.

빠른 시작

from pypdf import PdfReader, PdfWriter

# PDF 읽기
reader = PdfReader("document.pdf")
print(f"페이지 수: {len(reader.pages)}")

# 텍스트 추출
text = ""
for page in reader.pages:
    text += page.extract_text()

Python 라이브러리

pypdf - 기본 작업

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)

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)

메타데이터 추출

reader = PdfReader("document.pdf")
meta = reader.metadata
print(f"제목: {meta.title}")
print(f"저자: {meta.author}")
print(f"주제: {meta.subject}")
print(f"크리에이터: {meta.creator}")

페이지 회전

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

page = reader.pages[0]
page.rotate(90)  # 시계 방향으로 90도 회전
writer.add_page(page)

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

pdfplumber - 텍스트 및 표 추출

레이아웃을 유지한 텍스트 추출

import pdfplumber

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

표 추출

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"페이지 {i+1}의 표 {j+1}:")
            for row in table:
                print(row)

고급 표 추출

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)

reportlab - PDF 생성

기본 PDF 생성

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

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

# 텍스트 추가
c.drawString(100, height - 100, "Hello World!")
c.drawString(100, height - 120, "This is a PDF created with reportlab")

# 선 추가
c.line(100, height - 140, 400, height - 140)

# 저장
c.save()

여러 페이지 PDF 생성

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

# 콘텐츠 추가
title = Paragraph("Report Title", styles['Title'])
story.append(title)
story.append(Spacer(1, 12))

body = Paragraph("This is the body of the report. " * 20, styles['Normal'])
story.append(body)
story.append(PageBreak())

# 2페이지
story.append(Paragraph("Page 2", styles['Heading1']))
story.append(Paragraph("Content for page 2", styles['Normal']))

# PDF 생성
doc.build(story)

아래 첨자 및 위 첨자

중요: ReportLab PDF에서 유니코드 아래 첨자/위 첨자 문자(₀₁₂₃₄₅₆₇₈₉, ⁰¹²³⁴⁵⁶⁷⁸⁹)를 절대 사용하지 마세요. 내장 폰트에 이러한 글리프가 포함되어 있지 않아 검은색 상자로 렌더링됩니다.

대신 Paragraph 객체에서 ReportLab의 XML 마크업 태그를 사용하세요:

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

styles = getSampleStyleSheet()

# 아래 첨자: <sub> 태그 사용
chemical = Paragraph("H<sub>2</sub>O", styles['Normal'])

# 위 첨자: <super> 태그 사용
squared = Paragraph("x<super>2</super> + y<super>2</super>", styles['Normal'])

canvas로 그려진 텍스트(Paragraph 객체가 아닌 경우)의 경우 유니코드 아래 첨자/위 첨자 대신 글꼴 크기와 위치를 수동으로 조정하세요.

명령줄 도구

pdftotext (poppler-utils)

# 텍스트 추출
pdftotext input.pdf output.txt

# 레이아웃을 유지하며 텍스트 추출
pdftotext -layout input.pdf output.txt

# 특정 페이지 추출
pdftotext -f 1 -l 5 input.pdf output.txt  # 1-5페이지

qpdf

# PDF 병합
qpdf --empty --pages file1.pdf file2.pdf -- merged.pdf

# 페이지 분할
qpdf input.pdf --pages . 1-5 -- pages1-5.pdf
qpdf input.pdf --pages . 6-10 -- pages6-10.pdf

# 페이지 회전
qpdf input.pdf output.pdf --rotate=+90:1  # 1페이지를 90도 회전

# 암호 제거
qpdf --password=mypassword --decrypt encrypted.pdf decrypted.pdf

pdftk (사용 가능한 경우)

# 병합
pdftk file1.pdf file2.pdf cat output merged.pdf

# 분할
pdftk input.pdf burst

# 회전
pdftk input.pdf rotate 1east output rotated.pdf

일반 작업

스캔된 PDF에서 텍스트 추출

# 필요: pip install pytesseract pdf2image
import pytesseract
from pdf2image import convert_from_path

# PDF를 이미지로 변환
images = convert_from_path('scanned.pdf')

# 각 페이지 OCR
text = ""
for i, image in enumerate(images):
    text += f"페이지 {i+1}:\n"
    text += pytesseract.image_to_string(image)
    text += "\n\n"

print(text)

워터마크 추가

from pypdf import PdfReader, PdfWriter

# 워터마크 생성 (또는 기존 파일 로드)
watermark = PdfReader("watermark.pdf").pages[0]

# 모든 페이지에 적용
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)

이미지 추출

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

# 이 명령은 모든 이미지를 output_prefix-000.jpg, output_prefix-001.jpg 등으로 추출합니다.

암호 보호

from pypdf import PdfReader, PdfWriter

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

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

# 암호 추가
writer.encrypt("userpassword", "ownerpassword")

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

빠른 참조

작업최적 도구명령/코드
PDF 병합pypdfwriter.add_page(page)
PDF 분할pypdf파일당 한 페이지
텍스트 추출pdfplumberpage.extract_text()
표 추출pdfplumberpage.extract_tables()
PDF 생성reportlabCanvas 또는 Platypus
명령줄 병합qpdfqpdf --empty --pages ...
스캔된 PDF OCRpytesseract먼저 이미지로 변환
PDF 양식 채우기pdf-lib 또는 pypdf (FORMS.md 참조)FORMS.md 참조

다음 단계

  • 고급 pypdfium2 사용법은 REFERENCE.md를 참조하세요.
  • JavaScript 라이브러리(pdf-lib)는 REFERENCE.md를 참조하세요.
  • PDF 양식을 작성해야 하는 경우 FORMS.md의 지침을 따르세요.
  • 문제 해결 가이드는 REFERENCE.md를 참조하세요.

Individual skills in this repo

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

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches 007: Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Agentfolio: Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Animejs Animation: Advanced JavaScript animation library skill for creating complex, high-performance web animations.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astropy: Astropy is the core Python package for astronomy, providing essential functionality for astronomical research and data analysis.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Astro: Build content-focused websites with Astro — zero JS by default, islands architecture, multi-framework components, and Markdown/MDX support.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Emotional ARC Designer: One sentence - what this skill does and when to invoke it

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Fixing Motion Performance: Audit and fix animation performance issues including layout thrashing, compositor properties, scroll-linked motion, and blur effects.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches I18n Localization: Internationalization and localization patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Interactive Portfolio: Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches JQ: Expert jq usage for JSON querying, filtering, transformation, and pipeline integration.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Landing Page Generator: Generates high-converting Next.js/React landing pages with Tailwind CSS.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches LEX: Centralized ''Truth Engine'' for cross-jurisdictional legal context (US, EU, CA) and contract scaffolding.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Magic Animator: AI-powered animation tool for creating motion in logos, UI, icons, and social media assets.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Makepad Animation: CRITICAL: Use for Makepad animation system.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs APP Router Patterns: Comprehensive patterns for Next.js 14+ App Router architecture, Server Components, and modern full-stack React development.

Anhvu1107/all-agent-skill

ALWAYS use this when the user mentions Nextjs Best Practices, asks to build, debug, review, document, automate, test, configure, migrate, or make decisions in this domain, or the task clearly depends on Nextjs Best Practices; scope: Next.js App Router principles. Apply the bundled workflow, references, scripts, Senior Master standard, and Codex strict review gate before final output.

Anhvu1107/all-agent-skill

description: ALWAYS use this when the work is specifically about modern Next.js or React architecture, data flow, rendering strategy, routing, or performance-sensitive frontend behavior.

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches Nextjs Supabase Auth: Expert integration of Supabase Auth with Next.js App Router

Anhvu1107/all-agent-skill

ALWAYS use this when the request matches React Nextjs Development: React and Next.js 14+ application development with App Router, Server Components, TypeScript, Tailwind CSS, and modern frontend patterns.

Anhvu1107/all-agent-skill

ALWAYS use this when working with Remotion code, video compositions, rendering logic, timing, media assets, or React-based motion workflows.

관련 스킬