kordoc 4.2.0 → 4.2.1
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/README.md +15 -8
- package/dist/{-SXQIZHYA.js → -BSO3CDQQ.js} +12 -10
- package/dist/{pdf-ocr-2Z7VZIFI.cjs → chunk-35U3MVA2.cjs} +129 -8
- package/dist/chunk-35U3MVA2.cjs.map +1 -0
- package/dist/{chunk-4VNLZ2GZ.js → chunk-54WVWWT4.js} +1 -1
- package/dist/{chunk-4VNLZ2GZ.js.map → chunk-54WVWWT4.js.map} +1 -1
- package/dist/{chunk-WF2E5P2G.js → chunk-7IMNZ2BL.js} +2 -2
- package/dist/{chunk-V6U6YS5B.js → chunk-BHILWIE6.js} +2 -2
- package/dist/{chunk-PLIY23LY.js → chunk-BKBYTPSL.js} +2 -2
- package/dist/{chunk-4JPPLIIV.js → chunk-EZHWPKCH.js} +8 -3
- package/dist/{chunk-4JPPLIIV.js.map → chunk-EZHWPKCH.js.map} +1 -1
- package/dist/{pdf-ocr-VYE4DHD4.js → chunk-F5ECB53I.js} +128 -9
- package/dist/chunk-F5ECB53I.js.map +1 -0
- package/dist/{chunk-JP5YH3Z4.js → chunk-HTCKGSSW.js} +2 -2
- package/dist/{chunk-JP5YH3Z4.js.map → chunk-HTCKGSSW.js.map} +1 -1
- package/dist/{pdf-ocr-FJFXFADQ.js → chunk-KRAYUNFM.js} +129 -7
- package/dist/chunk-KRAYUNFM.js.map +1 -0
- package/dist/{chunk-26AJJCFF.js → chunk-L5JWKIOT.js} +9 -4
- package/dist/{chunk-26AJJCFF.js.map → chunk-L5JWKIOT.js.map} +1 -1
- package/dist/{chunk-XTCT6KQ5.cjs → chunk-LSXXGUWA.cjs} +4 -4
- package/dist/{chunk-XTCT6KQ5.cjs.map → chunk-LSXXGUWA.cjs.map} +1 -1
- package/dist/{chunk-6SHO3BNV.js → chunk-PLTG6ZRF.js} +3 -3
- package/dist/{chunk-ELOV2GIJ.js → chunk-QOC7S5VE.js} +2 -2
- package/dist/{chunk-CMN3SYZ3.js → chunk-QSB2RTX5.js} +2 -2
- package/dist/{chunk-LHROM2BO.cjs → chunk-R22KDUKW.cjs} +15 -10
- package/dist/chunk-R22KDUKW.cjs.map +1 -0
- package/dist/{chunk-F2HYH62H.cjs → chunk-RBUBZ2TA.cjs} +2 -2
- package/dist/{chunk-F2HYH62H.cjs.map → chunk-RBUBZ2TA.cjs.map} +1 -1
- package/dist/{chunk-YOO6ET6M.js → chunk-TCJRGFYY.js} +11 -1
- package/dist/chunk-TCJRGFYY.js.map +1 -0
- package/dist/{chunk-WQLHPOMJ.js → chunk-WJSGYVFD.js} +3 -3
- package/dist/{chunk-IGGRLWT5.js → chunk-WWYAYZ5U.js} +28 -9
- package/dist/chunk-WWYAYZ5U.js.map +1 -0
- package/dist/{chunk-FSXLSHCW.js → chunk-Z6LPEWIX.js} +2 -2
- package/dist/chunks-LRFS5NJE.js +10 -0
- package/dist/cli.js +19 -19
- package/dist/cli.js.map +1 -1
- package/dist/{detect-YEZX2XCF.js → detect-FX2ZHKZP.js} +4 -2
- package/dist/image-ocr-DALT7PFQ.js +65 -0
- package/dist/image-ocr-DALT7PFQ.js.map +1 -0
- package/dist/image-ocr-N5Z32R4U.cjs +66 -0
- package/dist/image-ocr-N5Z32R4U.cjs.map +1 -0
- package/dist/image-ocr-SLUEM3FA.js +69 -0
- package/dist/image-ocr-SLUEM3FA.js.map +1 -0
- package/dist/index.cjs +176 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +31 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +19 -19
- package/dist/mcp.js.map +1 -1
- package/dist/{parser-ND2YGQZR.js → parser-33TK5SMH.js} +5 -5
- package/dist/{parser-RBZHA6SY.js → parser-F5KY3YSD.js} +6 -6
- package/dist/{parser-WDZOMDG4.cjs → parser-R4CXIXRN.cjs} +24 -24
- package/dist/{parser-WDZOMDG4.cjs.map → parser-R4CXIXRN.cjs.map} +1 -1
- package/dist/pdf-ocr-34F5AQKK.js +12 -0
- package/dist/pdf-ocr-BXQZKU3N.js +15 -0
- package/dist/pdf-ocr-WGWZDHMV.cjs +13 -0
- package/dist/pdf-ocr-WGWZDHMV.cjs.map +1 -0
- package/dist/{profile-io-TWHDIVPL.js → profile-io-CBYHKLFU.js} +3 -3
- package/dist/{rasterize-W2NEZUSW.js → rasterize-AWMM2CSW.js} +2 -2
- package/dist/render-Y3IE2FIK.js +10 -0
- package/dist/render-Y3IE2FIK.js.map +1 -0
- package/dist/seal-7RXFCRMT.js +10 -0
- package/dist/seal-7RXFCRMT.js.map +1 -0
- package/dist/{watch-VWXJZT2R.js → watch-HKXCISVO.js} +10 -10
- package/package.json +1 -1
- package/dist/chunk-IGGRLWT5.js.map +0 -1
- package/dist/chunk-LHROM2BO.cjs.map +0 -1
- package/dist/chunk-YOO6ET6M.js.map +0 -1
- package/dist/chunks-ZQEFAZNC.js +0 -10
- package/dist/pdf-ocr-2Z7VZIFI.cjs.map +0 -1
- package/dist/pdf-ocr-FJFXFADQ.js.map +0 -1
- package/dist/pdf-ocr-VYE4DHD4.js.map +0 -1
- package/dist/render-4MG5QUDG.js +0 -10
- package/dist/seal-D2QNXJVO.js +0 -10
- /package/dist/{-SXQIZHYA.js.map → -BSO3CDQQ.js.map} +0 -0
- /package/dist/{chunk-WF2E5P2G.js.map → chunk-7IMNZ2BL.js.map} +0 -0
- /package/dist/{chunk-V6U6YS5B.js.map → chunk-BHILWIE6.js.map} +0 -0
- /package/dist/{chunk-PLIY23LY.js.map → chunk-BKBYTPSL.js.map} +0 -0
- /package/dist/{chunk-6SHO3BNV.js.map → chunk-PLTG6ZRF.js.map} +0 -0
- /package/dist/{chunk-ELOV2GIJ.js.map → chunk-QOC7S5VE.js.map} +0 -0
- /package/dist/{chunk-CMN3SYZ3.js.map → chunk-QSB2RTX5.js.map} +0 -0
- /package/dist/{chunk-WQLHPOMJ.js.map → chunk-WJSGYVFD.js.map} +0 -0
- /package/dist/{chunk-FSXLSHCW.js.map → chunk-Z6LPEWIX.js.map} +0 -0
- /package/dist/{chunks-ZQEFAZNC.js.map → chunks-LRFS5NJE.js.map} +0 -0
- /package/dist/{detect-YEZX2XCF.js.map → detect-FX2ZHKZP.js.map} +0 -0
- /package/dist/{parser-ND2YGQZR.js.map → parser-33TK5SMH.js.map} +0 -0
- /package/dist/{parser-RBZHA6SY.js.map → parser-F5KY3YSD.js.map} +0 -0
- /package/dist/{profile-io-TWHDIVPL.js.map → pdf-ocr-34F5AQKK.js.map} +0 -0
- /package/dist/{render-4MG5QUDG.js.map → pdf-ocr-BXQZKU3N.js.map} +0 -0
- /package/dist/{seal-D2QNXJVO.js.map → profile-io-CBYHKLFU.js.map} +0 -0
- /package/dist/{rasterize-W2NEZUSW.js.map → rasterize-AWMM2CSW.js.map} +0 -0
- /package/dist/{watch-VWXJZT2R.js.map → watch-HKXCISVO.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -203,7 +203,7 @@ interface OutlineItem {
|
|
|
203
203
|
}
|
|
204
204
|
/** 구조화된 에러 코드 — 프로그래밍적 에러 핸들링용 */
|
|
205
205
|
type ErrorCode = "EMPTY_INPUT" | "UNSUPPORTED_FORMAT" | "ENCRYPTED" | "DRM_PROTECTED" | "CORRUPTED" | "DECOMPRESSION_BOMB" | "ZIP_BOMB" | "IMAGE_BASED_PDF" | "NO_SECTIONS" | "PARSE_ERROR" | "MISSING_DEPENDENCY";
|
|
206
|
-
type FileType = "hwpx" | "hwp" | "hwp3" | "hwpml" | "pdf" | "xlsx" | "xls" | "docx" | "unknown";
|
|
206
|
+
type FileType = "hwpx" | "hwp" | "hwp3" | "hwpml" | "pdf" | "xlsx" | "xls" | "docx" | "image" | "unknown";
|
|
207
207
|
interface ParseResultBase {
|
|
208
208
|
fileType: FileType;
|
|
209
209
|
/** 페이지/섹션 수 — PDF: 실제 페이지 수, HWP/HWPX: 섹션 수, XLSX: 시트 수 */
|
|
@@ -1609,6 +1609,8 @@ declare const VERSION: string;
|
|
|
1609
1609
|
* ```
|
|
1610
1610
|
*/
|
|
1611
1611
|
declare function parse(input: string | ArrayBuffer | Buffer, options?: ParseOptions): Promise<ParseResult>;
|
|
1612
|
+
/** 이미지(PNG/JPEG/WebP)를 OCR 로 Markdown 변환 — 텍스트층이 없으므로 OCR 상시 적용 */
|
|
1613
|
+
declare function parseImage(buffer: ArrayBuffer, options?: ParseOptions): Promise<ParseResult>;
|
|
1612
1614
|
/** HWP 3.x (구버전 한컴 워드프로세서) 파일을 Markdown 으로 변환. */
|
|
1613
1615
|
declare function parseHwp3(buffer: ArrayBuffer, options?: ParseOptions): Promise<ParseResult>;
|
|
1614
1616
|
/** HWPX 파일을 Markdown으로 변환 */
|
|
@@ -1664,4 +1666,4 @@ interface FillFormOutput {
|
|
|
1664
1666
|
*/
|
|
1665
1667
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillInput>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
1666
1668
|
|
|
1667
|
-
export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BorderDef, type BorderFillDef, type BoundingBox, type CellCapability, type CellContext, type CellDiff, type CellProfile, type CharPrDef, type ChunkOptions, DEFAULT_REDACT_RULES, type DiffChangeType, type DiffResult, type DocChunk, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillInput, type FillOutputFormat, type FillResult, type FillValue, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type FormatProfile, type GongmunFont, type GongmunLintFinding, type GongmunNumbering, type GongmunOptions, type GongmunPreset, type GongmunPresetInput, type HwpxFillResult, HwpxSession, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type MeasureOptions, type OcrProvider, type OutlineItem, PRESET_ALIAS, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PlaceSealResult, type PrintOptions, type PrintPreset, type RedactHit, type RedactOptions, type RedactRule, type RedactTextResult, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SealOp, type SealPlacement, type SectionScan, type SpliceEdit, type TRange, type TableProfile, VERSION, type ValidateIssue, type ValidateResult, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToChunks, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, formatFillValue, gongmunLintWarnings, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, redactMarkdown, redactText, renderHtml, renderHwpxToSvg, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, validateHwpx };
|
|
1669
|
+
export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BorderDef, type BorderFillDef, type BoundingBox, type CellCapability, type CellContext, type CellDiff, type CellProfile, type CharPrDef, type ChunkOptions, DEFAULT_REDACT_RULES, type DiffChangeType, type DiffResult, type DocChunk, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillInput, type FillOutputFormat, type FillResult, type FillValue, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type FormatProfile, type GongmunFont, type GongmunLintFinding, type GongmunNumbering, type GongmunOptions, type GongmunPreset, type GongmunPresetInput, type HwpxFillResult, HwpxSession, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type MeasureOptions, type OcrProvider, type OutlineItem, PRESET_ALIAS, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PlaceSealResult, type PrintOptions, type PrintPreset, type RedactHit, type RedactOptions, type RedactRule, type RedactTextResult, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SealOp, type SealPlacement, type SectionScan, type SpliceEdit, type TRange, type TableProfile, VERSION, type ValidateIssue, type ValidateResult, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToChunks, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, formatFillValue, gongmunLintWarnings, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, redactMarkdown, redactText, renderHtml, renderHwpxToSvg, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, validateHwpx };
|
package/dist/index.d.ts
CHANGED
|
@@ -203,7 +203,7 @@ interface OutlineItem {
|
|
|
203
203
|
}
|
|
204
204
|
/** 구조화된 에러 코드 — 프로그래밍적 에러 핸들링용 */
|
|
205
205
|
type ErrorCode = "EMPTY_INPUT" | "UNSUPPORTED_FORMAT" | "ENCRYPTED" | "DRM_PROTECTED" | "CORRUPTED" | "DECOMPRESSION_BOMB" | "ZIP_BOMB" | "IMAGE_BASED_PDF" | "NO_SECTIONS" | "PARSE_ERROR" | "MISSING_DEPENDENCY";
|
|
206
|
-
type FileType = "hwpx" | "hwp" | "hwp3" | "hwpml" | "pdf" | "xlsx" | "xls" | "docx" | "unknown";
|
|
206
|
+
type FileType = "hwpx" | "hwp" | "hwp3" | "hwpml" | "pdf" | "xlsx" | "xls" | "docx" | "image" | "unknown";
|
|
207
207
|
interface ParseResultBase {
|
|
208
208
|
fileType: FileType;
|
|
209
209
|
/** 페이지/섹션 수 — PDF: 실제 페이지 수, HWP/HWPX: 섹션 수, XLSX: 시트 수 */
|
|
@@ -1609,6 +1609,8 @@ declare const VERSION: string;
|
|
|
1609
1609
|
* ```
|
|
1610
1610
|
*/
|
|
1611
1611
|
declare function parse(input: string | ArrayBuffer | Buffer, options?: ParseOptions): Promise<ParseResult>;
|
|
1612
|
+
/** 이미지(PNG/JPEG/WebP)를 OCR 로 Markdown 변환 — 텍스트층이 없으므로 OCR 상시 적용 */
|
|
1613
|
+
declare function parseImage(buffer: ArrayBuffer, options?: ParseOptions): Promise<ParseResult>;
|
|
1612
1614
|
/** HWP 3.x (구버전 한컴 워드프로세서) 파일을 Markdown 으로 변환. */
|
|
1613
1615
|
declare function parseHwp3(buffer: ArrayBuffer, options?: ParseOptions): Promise<ParseResult>;
|
|
1614
1616
|
/** HWPX 파일을 Markdown으로 변환 */
|
|
@@ -1664,4 +1666,4 @@ interface FillFormOutput {
|
|
|
1664
1666
|
*/
|
|
1665
1667
|
declare function fillForm(input: string | ArrayBuffer | Buffer, values: Record<string, FillInput>, outputFormat?: FillOutputFormat): Promise<FillFormOutput>;
|
|
1666
1668
|
|
|
1667
|
-
export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BorderDef, type BorderFillDef, type BoundingBox, type CellCapability, type CellContext, type CellDiff, type CellProfile, type CharPrDef, type ChunkOptions, DEFAULT_REDACT_RULES, type DiffChangeType, type DiffResult, type DocChunk, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillInput, type FillOutputFormat, type FillResult, type FillValue, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type FormatProfile, type GongmunFont, type GongmunLintFinding, type GongmunNumbering, type GongmunOptions, type GongmunPreset, type GongmunPresetInput, type HwpxFillResult, HwpxSession, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type MeasureOptions, type OcrProvider, type OutlineItem, PRESET_ALIAS, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PlaceSealResult, type PrintOptions, type PrintPreset, type RedactHit, type RedactOptions, type RedactRule, type RedactTextResult, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SealOp, type SealPlacement, type SectionScan, type SpliceEdit, type TRange, type TableProfile, VERSION, type ValidateIssue, type ValidateResult, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToChunks, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, formatFillValue, gongmunLintWarnings, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, redactMarkdown, redactText, renderHtml, renderHwpxToSvg, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, validateHwpx };
|
|
1669
|
+
export { type BlockCapability, type BlockCapabilityInfo, type BlockDiff, type BlockEdit, type BlockSourceRef, type BorderDef, type BorderFillDef, type BoundingBox, type CellCapability, type CellContext, type CellDiff, type CellProfile, type CharPrDef, type ChunkOptions, DEFAULT_REDACT_RULES, type DiffChangeType, type DiffResult, type DocChunk, type DocumentMetadata, type DocumentQualitySummary, type ErrorCode, type ExtractedImage, type FileType, type FillFormOutput, type FillInput, type FillOutputFormat, type FillResult, type FillValue, type FormField, type FormFieldSchema, type FormFieldType, type FormResult, type FormSchemaResult, type FormatProfile, type GongmunFont, type GongmunLintFinding, type GongmunNumbering, type GongmunOptions, type GongmunPreset, type GongmunPresetInput, type HwpxFillResult, HwpxSession, type HwpxTheme, type IRBlock, type IRBlockType, type IRCell, type IRTable, type ImageData, type InlineStyle, type MarkdownToHwpxOptions, type MeasureOptions, type OcrProvider, type OutlineItem, PRESET_ALIAS, type PageMargin, type PageQuality, type ParseFailure, type ParseOptions, type ParseResult, type ParseSuccess, type ParseWarning, type PatchOptions, type PatchResult, type PatchSkip, type PlaceSealResult, type PrintOptions, type PrintPreset, type RedactHit, type RedactOptions, type RedactRule, type RedactTextResult, type RenderSvgOptions, type RenderSvgResult, SPACE_EM_FIXED, SPACE_EM_FONT, type ScanCell, type ScanParaKind, type ScanParagraph, type ScanTable, type SealOp, type SealPlacement, type SectionScan, type SpliceEdit, type TRange, type TableProfile, VERSION, type ValidateIssue, type ValidateResult, ValueCursor, type WarningCode, type WatchOptions, type WrapMode, type WrapResult, applySplices, blocksToChunks, blocksToMarkdown, blocksToPdf, buildParagraphSplices, buildRangeSplices, charWidthEm1000, compare, detectFormat, detectOle2Format, detectZipFormat, diffBlocks, extractFormFields, extractFormSchema, fillForm, fillFormFields, fillHwpx, fillWithUniqueGuard, fitRatioForFewerLines, formatFillValue, gongmunLintWarnings, hwpxToProfile, incompatibleGongmunWarnings, inferFieldType, isHwpxFile, isKnownFont, isLabelCell, isOldHwpFile, isPdfFile, isZipFile, lintGongmunText, markdownToHwpx, markdownToPdf, measureTextWidth, normalizeGongmunPreset, openHwpxDocument, parse, parseDocx, parseHwp, parseHwp3, parseHwpml, parseHwpx, parseImage, parsePdf, parseXls, parseXlsx, patchHwp, patchHwpx, patchHwpxBlocks, placeSealHwpx, redactMarkdown, redactText, renderHtml, renderHwpxToSvg, scanSectionXml, simulateWrap, simulateWrapKeepWord, unknownFontWarnings, validateHwpx };
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
flattenLayoutTables,
|
|
9
9
|
inlineImagesIntoMarkdown,
|
|
10
10
|
mapPuaText
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7IMNZ2BL.js";
|
|
12
12
|
import {
|
|
13
13
|
parsePageRange
|
|
14
14
|
} from "./chunk-GE43BE46.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
sanitizeHref,
|
|
28
28
|
stripDtd,
|
|
29
29
|
toArrayBuffer
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-HTCKGSSW.js";
|
|
31
31
|
|
|
32
32
|
// src/index.ts
|
|
33
33
|
import { readFile } from "fs/promises";
|
|
@@ -247,6 +247,14 @@ function isPdfFile(buffer) {
|
|
|
247
247
|
const b = magicBytes(buffer);
|
|
248
248
|
return b[0] === 37 && b[1] === 80 && b[2] === 68 && b[3] === 70;
|
|
249
249
|
}
|
|
250
|
+
function isImageFile(buffer) {
|
|
251
|
+
if (buffer.byteLength < 12) return false;
|
|
252
|
+
const b = new Uint8Array(buffer, 0, 12);
|
|
253
|
+
if (b[0] === 137 && b[1] === 80 && b[2] === 78 && b[3] === 71) return true;
|
|
254
|
+
if (b[0] === 255 && b[1] === 216 && b[2] === 255) return true;
|
|
255
|
+
if (b[0] === 82 && b[1] === 73 && b[2] === 70 && b[3] === 70 && b[8] === 87 && b[9] === 69 && b[10] === 66 && b[11] === 80) return true;
|
|
256
|
+
return false;
|
|
257
|
+
}
|
|
250
258
|
function isHwpmlFile(buffer) {
|
|
251
259
|
const bytes = new Uint8Array(buffer, 0, Math.min(512, buffer.byteLength));
|
|
252
260
|
const head = new TextDecoder("utf-8", { fatal: false }).decode(bytes).replace(/^\uFEFF/, "");
|
|
@@ -259,6 +267,7 @@ function detectFormat(buffer) {
|
|
|
259
267
|
if (isOldHwpFile(buffer)) return "hwp";
|
|
260
268
|
if (isPdfFile(buffer)) return "pdf";
|
|
261
269
|
if (isHwpmlFile(buffer)) return "hwpml";
|
|
270
|
+
if (isImageFile(buffer)) return "image";
|
|
262
271
|
return "unknown";
|
|
263
272
|
}
|
|
264
273
|
function detectOle2Format(buffer) {
|
|
@@ -30446,10 +30455,28 @@ async function parse(input, options) {
|
|
|
30446
30455
|
return parseHwpml(buffer, opts);
|
|
30447
30456
|
case "pdf":
|
|
30448
30457
|
return parsePdf(buffer, opts);
|
|
30458
|
+
case "image":
|
|
30459
|
+
return parseImage(buffer, opts);
|
|
30449
30460
|
default:
|
|
30450
30461
|
return { success: false, fileType: "unknown", error: "\uC9C0\uC6D0\uD558\uC9C0 \uC54A\uB294 \uD30C\uC77C \uD615\uC2DD\uC785\uB2C8\uB2E4.", code: "UNSUPPORTED_FORMAT" };
|
|
30451
30462
|
}
|
|
30452
30463
|
}
|
|
30464
|
+
async function parseImage(buffer, options) {
|
|
30465
|
+
try {
|
|
30466
|
+
const { parseImageDocument } = await import("./image-ocr-DALT7PFQ.js");
|
|
30467
|
+
const { blocks, warnings } = await parseImageDocument(buffer, options);
|
|
30468
|
+
return {
|
|
30469
|
+
success: true,
|
|
30470
|
+
fileType: "image",
|
|
30471
|
+
markdown: blocksToMarkdown(blocks),
|
|
30472
|
+
blocks,
|
|
30473
|
+
warnings: warnings.length ? warnings : void 0,
|
|
30474
|
+
pageCount: 1
|
|
30475
|
+
};
|
|
30476
|
+
} catch (err) {
|
|
30477
|
+
return { success: false, fileType: "image", error: sanitizeError(err), code: classifyError(err) };
|
|
30478
|
+
}
|
|
30479
|
+
}
|
|
30453
30480
|
async function parseHwp3(buffer, options) {
|
|
30454
30481
|
try {
|
|
30455
30482
|
const { markdown, blocks, metadata, outline, warnings } = parseHwp3Document(buffer, options);
|
|
@@ -30494,7 +30521,7 @@ async function parseHwp(buffer, options) {
|
|
|
30494
30521
|
async function parsePdf(buffer, options) {
|
|
30495
30522
|
let parsePdfDocument;
|
|
30496
30523
|
try {
|
|
30497
|
-
const mod = await import("./parser-
|
|
30524
|
+
const mod = await import("./parser-33TK5SMH.js");
|
|
30498
30525
|
parsePdfDocument = mod.parsePdfDocument;
|
|
30499
30526
|
} catch {
|
|
30500
30527
|
return {
|
|
@@ -30633,6 +30660,7 @@ export {
|
|
|
30633
30660
|
parseHwp3,
|
|
30634
30661
|
parseHwpml,
|
|
30635
30662
|
parseHwpx,
|
|
30663
|
+
parseImage,
|
|
30636
30664
|
parsePdf,
|
|
30637
30665
|
parseXls,
|
|
30638
30666
|
parseXlsx,
|