pdf-page-verification-correction
하는 일
이 스킬은 생성된 PDF의 페이지 수를 확인하고 목표에 맞을 때까지 레이아웃을 바꿉니다. 고정된 쪽수의 보고서, 요약 또는 지도가 필요한 사람에게 맞습니다.
사용하는 경우
- ✓한 페이지 요약처럼 정확한 쪽수에 맞춰야 하는 PDF일 때.
- ✓이미지, 표, 긴 텍스트 때문에 쪽수를 예측하기 어려울 때.
- ✓첫 PDF가 너무 길거나 너무 짧게 나온 경우.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-page-verification-correction/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 요약 PDF는 정확히 두 쪽이어야 합니다. 쪽수를 확인하고 맞을 때까지 레이아웃을 조정해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 PDF를 만들고, PDF 라이브러리로 쪽수를 세고, 목표와 비교한 뒤, 글꼴 크기나 여백 같은 설정을 바꾸고 다시 시도합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
PDF Page Count Verification and Correction
This skill provides a systematic approach to ensure PDFs meet target page count requirements through iterative verification and layout adjustment.
When to Use
- Creating PDFs with strict page limits (e.g., reports, summaries, maps)
- When initial PDF generation may produce variable page counts
- When layout elements (images, tables, text) can cause unpredictable overflow
Prerequisites
- Python with PyPDF2 or fitz (PyMuPDF) installed
- PDF generation capability (ReportLab, matplotlib, etc.)
Workflow Steps
Step 1: Initial PDF Creation
Generate the PDF with your initial layout parameters:
def create_pdf(output_path, params):
"""Create PDF with given layout parameters"""
# Your PDF generation logic here
# params can include: image_size, table_density, font_size, margins
pass
Step 2: Verify Page Count
Check the generated PDF's page count:
import fitz # PyMuPDF
def verify_page_count(pdf_path):
"""Return the number of pages in the PDF"""
doc = fitz.open(pdf_path)
page_count = len(doc)
doc.close()
return page_count
# Alternative with PyPDF2
from PyPDF2 import PdfReader
def verify_page_count_pypdf2(pdf_path):
reader = PdfReader(pdf_path)
return len(reader.pages)
Step 3: Compare Against Target
def check_page_requirement(actual, target_max, target_exact=None):
"""
Check if page count meets requirements
Returns: (meets_requirement, adjustment_needed)
"""
if target_exact is not None:
meets = (actual == target_exact)
direction = "shrink" if actual > target_exact else "expand" if actual < target_exact else None
else:
meets = (actual <= target_max)
direction = "shrink" if actual > target_max else None
return meets, direction
Step 4: Adjust Layout Parameters
If page count exceeds target, adjust one or more parameters:
# Common adjustment strategies
ADJUSTMENT_STRATEGIES = {
'images': {
'action': 'reduce_size',
'param': 'image_scale',
'step': 0.1, # Reduce by 10%
'min': 0.5
},
'tables': {
'action': 'reduce_density',
'param': 'rows_per_page',
'step': 2, # Reduce by 2 rows per page
'min': 5
},
'fonts': {
'action': 'reduce_size',
'param': 'font_size',
'step': 1, # Reduce by 1pt
'min': 8
},
'margins': {
'action': 'reduce',
'param': 'margin_inches',
'step': 0.1, # Reduce by 0.1 inches
'min': 0.3
}
}
def adjust_params(current_params, direction, strategy='images'):
"""Apply adjustment to parameters"""
adjusted = current_params.copy()
strat = ADJUSTMENT_STRATEGIES[strategy]
if direction == 'shrink':
param = strat['param']
current_val = adjusted.get(param, 1.0)
new_val = max(current_val - strat['step'], strat['min'])
adjusted[param] = new_val
return adjusted
Step 5: Iterative Correction Loop
def create_pdf_with_validation(
output_path,
initial_params,
target_max_pages,
max_iterations=5
):
"""
Create PDF with iterative page count verification and correction
Args:
output_path: Where to save the final PDF
initial_params: Starting layout parameters
target_max_pages: Maximum allowed pages
max_iterations: Maximum adjustment attempts
Returns:
dict with 'success', 'final_page_count', 'iterations', 'final_params'
"""
params = initial_params.copy()
for iteration in range(max_iterations):
# Create PDF
create_pdf(output_path, params)
# Verify
page_count = verify_page_count(output_path)
# Check requirements
meets_req, direction = check_page_requirement(
page_count, target_max_pages
)
if meets_req:
print(f"✓ PDF created successfully: {page_count} pages")
return {
'success': True,
'final_page_count': page_count,
'iterations': iteration + 1,
'final_params': params
}
# Adjust and retry
print(f"Iteration {iteration + 1}: {page_count} pages (need ≤{target_max_pages})")
params = adjust_params(params, direction)
# Failed to conver
자주 묻는 질문
레이아웃의 어떤 부분을 바꿀 수 있나요?
가이드는 이미지 크기, 표의 밀도, 글꼴 크기, 여백을 나열합니다.
쪽수는 어떻게 확인하나요?
PyMuPDF나 PyPDF2로 파일에 몇 쪽이 있는지 확인합니다.
과정을 반복하나요?
네, 요구 사항이 충족될 때까지 확인과 조정을 반복합니다.
상세 정보
작성자의 원본 설명
Iterative workflow to verify PDF page counts and adjust layout parameters until requirements are met
repo: HKUDS/AgentPilot
인기도
- GitHub 스타
- 7.8k
- 순위
- #12930
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
agentpilot
7.8k작업을 준비하고 AgentPilot 루프를 실행해 변경을 제안, 테스트, 점수화하면서 프로젝트를 단계적으로 개선하도록 돕습니다.
openspace
7.8k에이전트 스킬을 저장하고 가져오는 도구인 OpenSpace를 설정하고, MCP를 통해 AI 앱에 연결하도록 돕습니다.
rsi-arena
7.8kAIME나 Terminal-Bench 같은 표준 AI 벤치마크 테스트를 설정하고 실행해 서로 다른 개선 방법을 비교하도록 돕습니다.
experiment-guide
7.8k프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.
비슷한 스킬
feishu-doc
394k에이전트가 문서 도구를 사용해 텍스트, 이미지, 표를 포함한 Feishu 클라우드 문서를 읽고, 만들고, 편집하도록 돕습니다.
feishu-drive
394k에이전트가 봇과 공유된 Feishu 클라우드 폴더의 파일을 찾아보고, 정리하고, 댓글을 달도록 돕습니다.
feishu-perm
394k에이전트가 요청을 충족하는 가장 작은 권한을 골라, Feishu 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.