HWP/HWPX Support (Phase 2)
Overview
PROOF supports Hangul Word Processor (.hwp) and its XML-based variant (.hwpx) files through a dedicated pyhwp-based converter on the a1 backend. This is part of the Docling preprocessing pipeline Phase 2.
- Markdown extraction:
pyhwp2mdconverts text, paragraphs, headings, lists, and tables into Markdown. - Image extraction:
pyhwpreads theBinDataOLE storage to extract embedded images. - Page estimation:
hwp_converter.get_page_count()reads the document summary info to estimate the number of pages.
Pipeline Flow
- Upload:
jobs.pydetects.hwp/.hwpxfiles viamedia_loader.HWP_TYPES. - Page count:
hwp_converter.get_page_count()is called on the uploaded file. - Worker routing:
tasks.pycallsrun_hwp()for single files or for files found inside archives. - Processing:
run_hwp()inpipeline_docling.py:- Extracts Markdown with
pyhwp2md. - Extracts
BinDataimages withpyhwp. - Optionally runs LLM layout refinement using the same settings as the Docling path.
- Extracts Markdown with
- Result: the extracted Markdown is merged into CSV/MD/XLSX output like any other Docling-supported document.
File Routing
media_loader.HWP_TYPES = {"hwp"}- Single file:
job.file_type in media_loader.HWP_TYPESbranch intasks.py. - Multi-file:
ftype in media_loader.HWP_TYPESbranch inside the archive extraction loop. - Extracted files are uploaded to Supabase Storage with the same path logic as PDF/Office documents.
Refinement
- The
use_docling_refinement/docling_refinementflag controls whether LLM post-processing is applied to HWP/HWPX results as well. - Charges are configured via
cost_per_docling_refinement_page_krw/cost_per_docling_refinement_page_usdinsettings_store.
API and Frontend
POST /api/jobs/uploadaccepts thedocling_refinementform field.UploadPage.jsxshows a checkbox labeled "Use Docling layout refinement" for Docling-compatible documents, including HWP/HWPX.- Supported file extensions include
.hwpand.hwpx.
Key Files
app/backend/core/hwp_converter.py— HWP/HWPX text, image, and page extraction.app/backend/core/pipeline_docling.py—run_hwp()function that reuses the same refinement path as Docling.app/backend/workers/tasks.py— routes HWP/HWPX files torun_hwp().app/backend/api/jobs.py— page counting and cost calculation for HWP/HWPX uploads.app/backend/core/media_loader.py—HWP_TYPESand file type detection.