Skip to main content

Python으로 HWP/HWPX 파일 생성·파싱·변환. HWP 문서를 Markdown으로, Markdown을 HWP/HWPX로.

Project description

HWP Converter AI

PyPI License: MIT Python

Python으로 HWP/HWPX 파일을 생성·파싱·변환합니다.

웹에서 바로 체험하기: 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 (자동 설치)

웹 서비스

코드 없이 브라우저에서 바로 변환하려면:

https://www.hwpsome.com

  • HWP ↔ Markdown 변환
  • AI 공문서 초안 생성
  • 맞춤법·행정 문체 교정 (Pro)
  • RAG 문서 검색 (Pro)

스펙 기반

한컴 공식 HWP 5.0 문서 파일 구조OWPML(KS X 6101) 표준을 기반으로 구현되었습니다.

본 제품은 한글과컴퓨터의 HWP 문서 파일(.hwp) 공개 문서를 참고하여 개발하였습니다.

라이선스

MIT License

Project details


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.3.tar.gz (67.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hwp_converter_ai-0.1.3-py3-none-any.whl (69.5 kB view details)

Uploaded Python 3

File details

Details for the file hwp_converter_ai-0.1.3.tar.gz.

File metadata

  • Download URL: hwp_converter_ai-0.1.3.tar.gz
  • Upload date:
  • Size: 67.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for hwp_converter_ai-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a01349602ce6ef2b5f9f00d66a7c94c2950bb202b1604bb5f33896e93fd429e7
MD5 c6cc0e09509645dcd0f1b48d88b825f0
BLAKE2b-256 5d993a4d8d7c27be3dc95421d236d0a616cdd4a39829858ce57b2dc4a96c992b

See more details on using hashes here.

File details

Details for the file hwp_converter_ai-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for hwp_converter_ai-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4b85ee3620cc03fe22d0cf1b8e20e10b711ca3a0ef40dbd1dc5498099908b960
MD5 a5aeb02c6c6de8632b5304b5440156df
BLAKE2b-256 3f891afebfccdf5ef2446a93d010588ba627605e638b58cc81f6b9763c91245b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page