@clazic/kordoc 2.7.4 → 2.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3112,7 +3112,7 @@ import JSZip2 from "jszip";
3112
3112
  import { DOMParser } from "@xmldom/xmldom";
3113
3113
 
3114
3114
  // src/utils.ts
3115
- var VERSION = true ? "2.7.3" : "0.0.0-dev";
3115
+ var VERSION = true ? "2.7.4" : "0.0.0-dev";
3116
3116
  function toArrayBuffer(buf) {
3117
3117
  if (buf.byteOffset === 0 && buf.byteLength === buf.buffer.byteLength) {
3118
3118
  return buf.buffer;
@@ -11478,7 +11478,7 @@ async function resolveSoffice(emitter, autoInstall = true) {
11478
11478
  // src/convert/libreoffice.ts
11479
11479
  var libreConvert = libre.convert;
11480
11480
  var libreConvertWithOptions = libre.convertWithOptions;
11481
- async function convertBuffer(buffer, targetExt, timeoutMs = 6e4, sofficePath) {
11481
+ async function convertBuffer(buffer, targetExt, timeoutMs = 6e4, sofficePath, sourceExt) {
11482
11482
  return new Promise((resolve4, reject) => {
11483
11483
  const timer = setTimeout(() => {
11484
11484
  reject(
@@ -11499,7 +11499,8 @@ async function convertBuffer(buffer, targetExt, timeoutMs = 6e4, sofficePath) {
11499
11499
  resolve4(done);
11500
11500
  };
11501
11501
  if (sofficePath) {
11502
- libreConvertWithOptions(buffer, targetExt, void 0, { sofficeBinaryPaths: [sofficePath] }, cb);
11502
+ const fileName = sourceExt ? `source${sourceExt}` : "source";
11503
+ libreConvertWithOptions(buffer, targetExt, void 0, { sofficeBinaryPaths: [sofficePath], fileName }, cb);
11503
11504
  } else {
11504
11505
  libreConvert(buffer, targetExt, void 0, cb);
11505
11506
  }
@@ -11658,7 +11659,8 @@ async function convertToPdf(input, options) {
11658
11659
  try {
11659
11660
  emitter.convertStart("\uBCC0\uD658 \uC2DC\uC791...");
11660
11661
  emitter.progress(10, "\uBCC0\uD658 \uC911...");
11661
- const pdf = await convertBuffer(buffer, ".pdf", options?.timeoutMs, sofficePath);
11662
+ const sourceExt = format === "hwpx" ? ".hwpx" : ".hwp";
11663
+ const pdf = await convertBuffer(buffer, ".pdf", options?.timeoutMs, sofficePath, sourceExt);
11662
11664
  emitter.progress(100, "\uBCC0\uD658 \uC644\uB8CC");
11663
11665
  emitter.convertDone("\uBCC0\uD658 \uC644\uB8CC");
11664
11666
  const result = {
@@ -12022,7 +12024,8 @@ async function runUnifiedOcrPipeline(inputPath, options = {}) {
12022
12024
  }
12023
12025
  workingPdfPath = join5(workspaceDir, `${stem}.pdf`);
12024
12026
  const inputBuffer = await readFile2(absInput);
12025
- const out = await convertBuffer(inputBuffer, ".pdf", 5 * 6e4, resolvedSofficePath);
12027
+ const sourceExt = extname(absInput).toLowerCase();
12028
+ const out = await convertBuffer(inputBuffer, ".pdf", 5 * 6e4, resolvedSofficePath, sourceExt);
12026
12029
  await writeFile2(workingPdfPath, out);
12027
12030
  }
12028
12031
  timingsMs.convert = elapsedMs(convertStart);