const path = require('path')
const { convert } = require('docx2pdf-converter')

function main() {
  const inputPath = process.argv[2]
  const outputPath = process.argv[3]

  if (!inputPath || !outputPath) {
    throw new Error('缺少 DOCX 或 PDF 路径')
  }

  convert(path.resolve(inputPath), path.resolve(outputPath))
}

try {
  main()
} catch (error) {
  console.error(error instanceof Error ? error.message : String(error))
  process.exit(1)
}
