Python으로 HWP/HWPX 파일 생성·파싱·변환. 한컴오피스 문서를 Markdown으로, Markdown을 HWP/HWPX로.
Project description
HWP Converter AI
Python으로 HWP/HWPX 파일을 생성·파싱·변환합니다. 한컴오피스 없이 HWP 문서를 프로그래밍으로 처리할 수 있습니다.
웹에서 바로 체험하기: https://www.hwpsome.com
설치
pip install hwp-converter-ai
빠른 시작
Markdown → HWP (한글 97~2024)
from hwp_converter_ai import HwpWriter
HwpWriter().from_markdown("# 업무 보고\n\n내용입니다.", "report.hwp")
Markdown → HWPX (한글 2014+)
from hwp_converter_ai import HwpxGenerator
HwpxGenerator().from_markdown("# 제목\n\n**볼드** 텍스트", output_path="report.hwpx")
HWP → Markdown
from hwp_converter_ai import HwpParser
ir = HwpParser.parse("document.hwp")
print(ir.to_markdown())
HWPX → Markdown
from hwp_converter_ai import HwpxParser
ir = HwpxParser().parse("document.hwpx")
print(ir.to_markdown())
지원 기능
| 기능 | HWP | HWPX |
|---|---|---|
| 텍스트/문단 | ✅ | ✅ |
| 제목 (H1~H3) | ✅ | ✅ |
| 볼드/이탤릭 | ✅ | ✅ |
| 표 (테두리 포함) | ✅ | ✅ |
| 이미지 추출 | ✅ | ✅ |
| 리스트 감지 | ✅ | ✅ |
| 긴 문서 | ✅ | ✅ |
예제
볼드/이탤릭 포함 문서
from hwp_converter_ai import HwpWriter
md = """# 업무 보고서
일반 텍스트 **볼드 강조** 그리고 *이탤릭 참고*.
| 항목 | 상태 |
|------|------|
| 변환 | 완료 |
| 교정 | 진행중 |
"""
HwpWriter().from_markdown(md, "report.hwp")
HWP 파싱 후 텍스트 추출
from hwp_converter_ai import HwpParser
ir = HwpParser.parse("input.hwp")
# Markdown으로
print(ir.to_markdown())
# 순수 텍스트로 (검색/인덱싱용)
print(ir.to_plain_text())
IR(중간 표현) 직접 조작
from hwp_converter_ai import HwpWriter, DocumentIR, BlockNode, InlineNode, BlockType, InlineType
ir = DocumentIR(title="보고서")
ir.blocks.append(BlockNode(
type=BlockType.HEADING, level=1,
children=[InlineNode(type=InlineType.TEXT, text="제목")]
))
ir.blocks.append(BlockNode(
type=BlockType.PARAGRAPH,
children=[
InlineNode(type=InlineType.TEXT, text="일반 "),
InlineNode(type=InlineType.BOLD, text="강조"),
]
))
HwpWriter().from_ir(ir, "custom.hwp")
요구사항
- Python 3.10+
olefile(자동 설치)
웹 서비스
코드 없이 브라우저에서 바로 변환하려면:
- HWP ↔ Markdown 변환
- AI 공문서 초안 생성
- 맞춤법·행정 문체 교정 (Pro)
- RAG 문서 검색 (Pro)
라이선스
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hwp_converter_ai-0.1.1.tar.gz
(65.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hwp_converter_ai-0.1.1.tar.gz.
File metadata
- Download URL: hwp_converter_ai-0.1.1.tar.gz
- Upload date:
- Size: 65.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dd00f6ddaa2ff694ac8b3175b5992908d93a67fa7566e18be493ed611ec7574
|
|
| MD5 |
913de1ebb3a9d8a57125e1b0cd207631
|
|
| BLAKE2b-256 |
f9e3fc01af306a4815a2ee30bb11f9fd4e62f102c4492205835865caa72d01db
|
File details
Details for the file hwp_converter_ai-0.1.1-py3-none-any.whl.
File metadata
- Download URL: hwp_converter_ai-0.1.1-py3-none-any.whl
- Upload date:
- Size: 67.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d4987fc6da0c4c2e8fb3a776146b0da00ceb7c327af0172b02700334bf30548
|
|
| MD5 |
6184726a892a90d970c96eaba3d1ec25
|
|
| BLAKE2b-256 |
9405e93f936c2056486ba01ad496cb9801ab8feee2614661507ab5332fedc0e1
|