Python bindings for native rhwp HWP to PDF conversion
Project description
hwp-ingest
Rust-backed Python package for Korean HWP/HWPX ingestion.
Current public alpha: HWP to PDF conversion and page-level SVG artifacts through a small typed Python facade.
Current alpha scope
0.1.0a2 is a public alpha for HWP to PDF conversion and page-level SVG
artifact output. Install it with an exact pre-release pin:
uv pip install hwp-ingest==0.1.0a2
# or
python -m pip install hwp-ingest==0.1.0a2
Release CI is configured to build Linux x86_64/aarch64, macOS Intel/Apple
Silicon, and Windows x86_64 wheels. Native runner wheel jobs install
rsvg-convert and run a PDF conversion smoke test; the Linux aarch64 job
cross-builds the wheel and verifies the artifact payload before publishing.
Runtime PDF dependency
PDF conversion requires the rsvg-convert executable from librsvg at runtime.
The Python wheel does not bundle this executable.
SVG output does not require rsvg-convert; that executable is only needed for PDF conversion.
Check availability:
rsvg-convert --version
Install examples:
# Debian/Ubuntu
sudo apt-get install librsvg2-bin
# Fedora/RHEL
sudo dnf install librsvg2-tools
# Arch Linux
sudo pacman -S librsvg
# macOS
brew install librsvg
On Windows, install librsvg/rsvg-convert and ensure rsvg-convert.exe is on
PATH. If rsvg-convert is missing, PDF conversion raises
hwp_ingest.HwpIngestError with a clear message. svg2pdf is not used as an
automatic fallback because it is known to drop clipped table text in some HWP
documents.
Quick start
Convert an HWP file to a PDF next to the input file:
from pathlib import Path
import hwp_ingest
input_path = Path("document.hwp")
output_path = hwp_ingest.to_pdf_file(input_path, overwrite=True)
print(output_path)
Convert one zero-based page to bytes:
from pathlib import Path
import hwp_ingest
pdf_bytes = hwp_ingest.to_pdf_bytes(
Path("document.hwp").read_bytes(),
page_index=0,
)
Path("page-1.pdf").write_bytes(pdf_bytes)
Render SVG page artifacts without the PDF backend:
from pathlib import Path
import hwp_ingest
svg_pages = hwp_ingest.to_svg_pages(Path("document.hwp").read_bytes())
Path("page-1.svg").write_bytes(svg_pages[0])
Read basic document metadata:
from pathlib import Path
import hwp_ingest
info = hwp_ingest.analyze_bytes(Path("document.hwp").read_bytes())
print(info.page_count)
Python API
The package is typed and ships py.typed plus checked-in .pyi stubs.
hwp_ingest.analyze_bytes(data: bytes) -> hwp_ingest.DocumentInfo
Returns a DocumentInfo object. DocumentInfo.page_count is the number of
renderable pages discovered in the HWP bytes.
hwp_ingest.to_pdf_bytes(
data: bytes,
*,
page_index: int | None = None,
) -> bytes
Returns PDF bytes. page_index is zero-based. Pass None to convert the full
document.
hwp_ingest.to_svg_pages(
data: bytes,
*,
page_index: int | None = None,
) -> list[bytes]
Returns one SVG document per selected page as bytes. page_index is
zero-based. Pass None to render all pages in document order. SVG output does
not require rsvg-convert.
hwp_ingest.to_pdf_file(
input_path: str | os.PathLike[str],
output_path: str | os.PathLike[str] | None = None,
*,
page_index: int | None = None,
overwrite: bool = False,
) -> pathlib.Path
Writes a PDF and returns the output path. If output_path is None, the output
uses the input path with a .pdf suffix. Existing output files are protected
unless overwrite=True.
hwp_ingest.to_svg_files(
input_path: str | os.PathLike[str],
output_dir: str | os.PathLike[str] | None = None,
*,
page_index: int | None = None,
overwrite: bool = False,
) -> list[pathlib.Path]
Writes one SVG file per selected page and returns paths in page order. If
output_dir is None, SVG files are written beside the input file. Generated
filenames are stable and use one-based visible page numbers:
<stem>.page-0001.svg, <stem>.page-0002.svg, and so on. Existing output
files are protected unless overwrite=True.
Errors
ValueError: negativepage_index, empty documents, or out-of-range pages.FileExistsError: output exists andoverwrite=False.FileNotFoundError: input file path does not exist.hwp_ingest.HwpIngestError: parse, render, PDF backend, or output write failures.
Local development
cargo test --workspace
uv run maturin develop
uv run pytest
Build distributable artifacts locally:
uv run maturin sdist --out dist
uv run --with ziglang maturin build --release --locked --out dist --compatibility pypi --zig
Notices
This project includes vendored portions of rhwp.
본 제품은 한글과컴퓨터의 HWP 문서 파일(.hwp) 공개 문서를 참고하여 개발하였습니다.
"한글", "한컴", "HWP", and "HWPX" are registered trademarks of Hancom Inc.
hwp-ingest is an independent open-source project and is not affiliated with,
sponsored by, or endorsed by Hancom Inc.
See NOTICE, THIRD_PARTY_LICENSES.md, and vendor/rhwp-subset/NOTICE for
vendored source attribution and license details.
Project direction
See docs/rhwp-python-binding-plan.md for batch engine, semantic output, vendor/upstream sync, and production pipeline direction.
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
Built Distributions
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_ingest-0.1.0a2.tar.gz.
File metadata
- Download URL: hwp_ingest-0.1.0a2.tar.gz
- Upload date:
- Size: 2.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99e67b0c4b20b72e6ba25da6d9d0e798978e01a2af0765a8be8e03c9756f48b7
|
|
| MD5 |
cb5b430dbfc6f7406d32bbd7f03225b2
|
|
| BLAKE2b-256 |
92d475815f5efdef63576dba535cd47698da720442de94cf1a532fe66c097522
|
Provenance
The following attestation bundles were made for hwp_ingest-0.1.0a2.tar.gz:
Publisher:
publish.yml on iosif2/hwp-ingest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hwp_ingest-0.1.0a2.tar.gz -
Subject digest:
99e67b0c4b20b72e6ba25da6d9d0e798978e01a2af0765a8be8e03c9756f48b7 - Sigstore transparency entry: 2084444041
- Sigstore integration time:
-
Permalink:
iosif2/hwp-ingest@2979f8f688dd4e7e5af5c5fb3fc60c4efd8a43be -
Branch / Tag:
refs/tags/v0.1.0a2 - Owner: https://github.com/iosif2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2979f8f688dd4e7e5af5c5fb3fc60c4efd8a43be -
Trigger Event:
push
-
Statement type:
File details
Details for the file hwp_ingest-0.1.0a2-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: hwp_ingest-0.1.0a2-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6b5be40d7f3d2b4e10f13c7e2684de4b737ab9fd78f3cf199e98eff8e56e52f
|
|
| MD5 |
45666908852c322792ac9b90e3528c2c
|
|
| BLAKE2b-256 |
a6609028a195d9216050cfdda0664436b193a887743996a9cbaa1a7a306bc230
|
Provenance
The following attestation bundles were made for hwp_ingest-0.1.0a2-cp310-abi3-win_amd64.whl:
Publisher:
publish.yml on iosif2/hwp-ingest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hwp_ingest-0.1.0a2-cp310-abi3-win_amd64.whl -
Subject digest:
d6b5be40d7f3d2b4e10f13c7e2684de4b737ab9fd78f3cf199e98eff8e56e52f - Sigstore transparency entry: 2084444104
- Sigstore integration time:
-
Permalink:
iosif2/hwp-ingest@2979f8f688dd4e7e5af5c5fb3fc60c4efd8a43be -
Branch / Tag:
refs/tags/v0.1.0a2 - Owner: https://github.com/iosif2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2979f8f688dd4e7e5af5c5fb3fc60c4efd8a43be -
Trigger Event:
push
-
Statement type:
File details
Details for the file hwp_ingest-0.1.0a2-cp310-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: hwp_ingest-0.1.0a2-cp310-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 3.0 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e28167955476b3b4615d12e75bdfc4e804e4ed9578bb2adf94c7a81f361b6bd
|
|
| MD5 |
2d7dfede1dbae0e8c1080c7fc30044f4
|
|
| BLAKE2b-256 |
e2c7b9788940e175a9d8a5fddfcfb4c16c126621982ce27dff14a43a544d0a98
|
Provenance
The following attestation bundles were made for hwp_ingest-0.1.0a2-cp310-abi3-manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on iosif2/hwp-ingest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hwp_ingest-0.1.0a2-cp310-abi3-manylinux_2_28_x86_64.whl -
Subject digest:
7e28167955476b3b4615d12e75bdfc4e804e4ed9578bb2adf94c7a81f361b6bd - Sigstore transparency entry: 2084444085
- Sigstore integration time:
-
Permalink:
iosif2/hwp-ingest@2979f8f688dd4e7e5af5c5fb3fc60c4efd8a43be -
Branch / Tag:
refs/tags/v0.1.0a2 - Owner: https://github.com/iosif2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2979f8f688dd4e7e5af5c5fb3fc60c4efd8a43be -
Trigger Event:
push
-
Statement type:
File details
Details for the file hwp_ingest-0.1.0a2-cp310-abi3-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: hwp_ingest-0.1.0a2-cp310-abi3-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bbb6de495fa9cb5079bf82e15a1ad358738c8f982b1ef21573599968c03f845
|
|
| MD5 |
dfca83e78f6aac78970ac5f3a1b03821
|
|
| BLAKE2b-256 |
5234c24da2580d5021c70d75e2b7d70a31dfe1e94b6773074209a9978021fd1c
|
Provenance
The following attestation bundles were made for hwp_ingest-0.1.0a2-cp310-abi3-manylinux_2_28_aarch64.whl:
Publisher:
publish.yml on iosif2/hwp-ingest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hwp_ingest-0.1.0a2-cp310-abi3-manylinux_2_28_aarch64.whl -
Subject digest:
6bbb6de495fa9cb5079bf82e15a1ad358738c8f982b1ef21573599968c03f845 - Sigstore transparency entry: 2084444092
- Sigstore integration time:
-
Permalink:
iosif2/hwp-ingest@2979f8f688dd4e7e5af5c5fb3fc60c4efd8a43be -
Branch / Tag:
refs/tags/v0.1.0a2 - Owner: https://github.com/iosif2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2979f8f688dd4e7e5af5c5fb3fc60c4efd8a43be -
Trigger Event:
push
-
Statement type:
File details
Details for the file hwp_ingest-0.1.0a2-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: hwp_ingest-0.1.0a2-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 2.6 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b72c3a4c9d06387d28917b3be6f63d9da6335e60ca02d9241a85883b547bab7
|
|
| MD5 |
17a76e068fc8dc629eb9830d2eed2e13
|
|
| BLAKE2b-256 |
dbaf2dd271d4823c60e20373cbeff841e206b65d07821af4e6deaf254820a613
|
Provenance
The following attestation bundles were made for hwp_ingest-0.1.0a2-cp310-abi3-macosx_11_0_arm64.whl:
Publisher:
publish.yml on iosif2/hwp-ingest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hwp_ingest-0.1.0a2-cp310-abi3-macosx_11_0_arm64.whl -
Subject digest:
0b72c3a4c9d06387d28917b3be6f63d9da6335e60ca02d9241a85883b547bab7 - Sigstore transparency entry: 2084444071
- Sigstore integration time:
-
Permalink:
iosif2/hwp-ingest@2979f8f688dd4e7e5af5c5fb3fc60c4efd8a43be -
Branch / Tag:
refs/tags/v0.1.0a2 - Owner: https://github.com/iosif2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2979f8f688dd4e7e5af5c5fb3fc60c4efd8a43be -
Trigger Event:
push
-
Statement type:
File details
Details for the file hwp_ingest-0.1.0a2-cp310-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: hwp_ingest-0.1.0a2-cp310-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.7 MB
- Tags: CPython 3.10+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa3cfdf7a7b446d2cbee7f87e334126f53df36288c2189a1d5a67f8fe51c3f24
|
|
| MD5 |
bd89a6247ba41deeb741b1fa9dde56a8
|
|
| BLAKE2b-256 |
f92bd313dc48e922ace80be67390620b8765b5f57889c6906bec2d95c4f63737
|
Provenance
The following attestation bundles were made for hwp_ingest-0.1.0a2-cp310-abi3-macosx_10_12_x86_64.whl:
Publisher:
publish.yml on iosif2/hwp-ingest
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hwp_ingest-0.1.0a2-cp310-abi3-macosx_10_12_x86_64.whl -
Subject digest:
aa3cfdf7a7b446d2cbee7f87e334126f53df36288c2189a1d5a67f8fe51c3f24 - Sigstore transparency entry: 2084444057
- Sigstore integration time:
-
Permalink:
iosif2/hwp-ingest@2979f8f688dd4e7e5af5c5fb3fc60c4efd8a43be -
Branch / Tag:
refs/tags/v0.1.0a2 - Owner: https://github.com/iosif2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2979f8f688dd4e7e5af5c5fb3fc60c4efd8a43be -
Trigger Event:
push
-
Statement type: