File size: 1,050 Bytes
cae0b38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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())