Initial commit to new repository
This commit is contained in:
63
dist/AxCopilot/skills/pdf-processor.skill.md
vendored
Normal file
63
dist/AxCopilot/skills/pdf-processor.skill.md
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
name: pdf-processor
|
||||
label: PDF 처리
|
||||
description: Python을 사용하여 PDF에서 텍스트/표를 추출하거나 PDF를 생성합니다.
|
||||
icon: \uE9F9
|
||||
requires: python
|
||||
tabs: cowork
|
||||
---
|
||||
|
||||
PDF 파일을 읽거나 새 PDF를 생성하세요.
|
||||
|
||||
## 사전 준비
|
||||
필요한 패키지를 확인하고 설치하세요:
|
||||
```
|
||||
process_run: pip install pypdf pdfplumber reportlab
|
||||
```
|
||||
|
||||
## 작업 절차
|
||||
|
||||
### PDF 텍스트 추출
|
||||
1. **파일 확인**: folder_map으로 PDF 파일 위치 확인
|
||||
2. **추출 스크립트 작성**: file_write로 Python 스크립트 생성
|
||||
3. **실행**: process_run으로 실행
|
||||
4. **결과 전달**: 추출된 텍스트를 사용자에게 전달
|
||||
|
||||
### PDF 생성
|
||||
1. **내용 파악**: 사용자가 원하는 문서 내용 확인
|
||||
2. **생성 스크립트 작성**: file_write로 Python 스크립트 생성
|
||||
3. **실행 및 확인**: process_run으로 실행
|
||||
|
||||
## 텍스트 추출 템플릿
|
||||
```python
|
||||
import pdfplumber
|
||||
import json
|
||||
|
||||
results = []
|
||||
with pdfplumber.open('input.pdf') as pdf:
|
||||
for i, page in enumerate(pdf.pages):
|
||||
text = page.extract_text() or ''
|
||||
tables = page.extract_tables() or []
|
||||
results.append({
|
||||
'page': i + 1,
|
||||
'text': text,
|
||||
'tables': tables,
|
||||
})
|
||||
|
||||
with open('pdf_extracted.json', 'w', encoding='utf-8') as f:
|
||||
json.dump(results, f, ensure_ascii=False, indent=2)
|
||||
|
||||
for r in results:
|
||||
print(f"--- 페이지 {r['page']} ---")
|
||||
print(r['text'][:500])
|
||||
```
|
||||
|
||||
## 지원 기능
|
||||
- 텍스트 추출 (페이지별)
|
||||
- 표 추출 (구조 보존)
|
||||
- PDF 병합 / 분할
|
||||
- PDF 생성 (reportlab)
|
||||
- 페이지 회전
|
||||
- 메타데이터 읽기
|
||||
|
||||
한국어로 안내하세요. 원본 PDF는 수정하지 마세요.
|
||||
Reference in New Issue
Block a user