| from pyhwp.html_converter import HwpToHtmlConverter | |
| import os | |
| import sys | |
| def main(): | |
| hwp_file = 'verify_test.hwp' | |
| html_file = 'verify_test.xhtml' | |
| if not os.path.exists(hwp_file): | |
| print(f"Error: {hwp_file} not found.") | |
| return 1 | |
| print(f"Converting {hwp_file} to {html_file}...") | |
| try: | |
| converter = HwpToHtmlConverter(hwp_file) | |
| converter.convert(html_file) | |
| if os.path.exists(html_file): | |
| size = os.path.getsize(html_file) | |
| print(f"Success! Generated {html_file} ({size} bytes).") | |
| # Optional: Print first few lines of output | |
| with open(html_file, 'r', encoding='utf-8') as f: | |
| print("--- Output Content Preview ---") | |
| print(f.read()[:500]) | |
| print("... (truncated)") | |
| else: | |
| print("Error: Output file was not created.") | |
| return 1 | |
| except Exception as e: | |
| print(f"Conversion failed with error: {e}") | |
| return 1 | |
| if __name__ == "__main__": | |
| sys.exit(main()) | |