@heripo/pdf-parser 0.1.35 → 0.1.37
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.ko.md +1 -1
- package/README.md +1 -1
- package/dist/index.cjs +36 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -590,6 +590,9 @@ var DoclingServer = class _DoclingServer {
|
|
|
590
590
|
this.venvPath = venvPath;
|
|
591
591
|
this.port = port;
|
|
592
592
|
}
|
|
593
|
+
logger;
|
|
594
|
+
venvPath;
|
|
595
|
+
port;
|
|
593
596
|
async isPortInUse() {
|
|
594
597
|
try {
|
|
595
598
|
const result = await spawnAsync("lsof", ["-ti", `:${this.port}`]);
|
|
@@ -736,6 +739,8 @@ var PythonEnvironment = class {
|
|
|
736
739
|
this.logger = logger;
|
|
737
740
|
this.venvPath = venvPath;
|
|
738
741
|
}
|
|
742
|
+
logger;
|
|
743
|
+
venvPath;
|
|
739
744
|
async setup() {
|
|
740
745
|
await this.checkPythonVersion();
|
|
741
746
|
await this.setupPythonEnvironment();
|
|
@@ -989,6 +994,7 @@ var PdfTextExtractor = class _PdfTextExtractor {
|
|
|
989
994
|
constructor(logger) {
|
|
990
995
|
this.logger = logger;
|
|
991
996
|
}
|
|
997
|
+
logger;
|
|
992
998
|
/**
|
|
993
999
|
* Safely extract page texts: returns the map on success, `undefined` on
|
|
994
1000
|
* failure. Failures are logged as a single warning and do not throw, so
|
|
@@ -1141,6 +1147,8 @@ var PdfLanguageDetector = class {
|
|
|
1141
1147
|
this.pageRenderer = pageRenderer;
|
|
1142
1148
|
this.textExtractor = textExtractor ?? new PdfTextExtractor(logger);
|
|
1143
1149
|
}
|
|
1150
|
+
logger;
|
|
1151
|
+
pageRenderer;
|
|
1144
1152
|
textExtractor;
|
|
1145
1153
|
async detect(pdfPath, outputDir, options) {
|
|
1146
1154
|
this.logger.info(
|
|
@@ -1357,6 +1365,8 @@ var ImagePdfFallbackError = class extends Error {
|
|
|
1357
1365
|
this.originalError = originalError;
|
|
1358
1366
|
this.fallbackError = fallbackError;
|
|
1359
1367
|
}
|
|
1368
|
+
originalError;
|
|
1369
|
+
fallbackError;
|
|
1360
1370
|
name = "ImagePdfFallbackError";
|
|
1361
1371
|
};
|
|
1362
1372
|
|
|
@@ -1368,6 +1378,7 @@ var PageRenderer = class {
|
|
|
1368
1378
|
constructor(logger) {
|
|
1369
1379
|
this.logger = logger;
|
|
1370
1380
|
}
|
|
1381
|
+
logger;
|
|
1371
1382
|
lastLoggedPercent = 0;
|
|
1372
1383
|
/**
|
|
1373
1384
|
* Render all pages of a PDF to individual PNG files.
|
|
@@ -1493,6 +1504,7 @@ var InvalidDocumentTypeError = class extends Error {
|
|
|
1493
1504
|
);
|
|
1494
1505
|
this.reason = reason;
|
|
1495
1506
|
}
|
|
1507
|
+
reason;
|
|
1496
1508
|
name = "InvalidDocumentTypeError";
|
|
1497
1509
|
code = "INVALID_DOCUMENT_TYPE";
|
|
1498
1510
|
};
|
|
@@ -2423,6 +2435,10 @@ var ChunkedPDFConverter = class {
|
|
|
2423
2435
|
this.config = config;
|
|
2424
2436
|
this.timeout = timeout;
|
|
2425
2437
|
}
|
|
2438
|
+
logger;
|
|
2439
|
+
client;
|
|
2440
|
+
config;
|
|
2441
|
+
timeout;
|
|
2426
2442
|
/**
|
|
2427
2443
|
* Convert a local PDF in chunks.
|
|
2428
2444
|
*
|
|
@@ -2769,6 +2785,9 @@ var DoclingConversionExecutor = class {
|
|
|
2769
2785
|
this.client = client;
|
|
2770
2786
|
this.timeout = timeout;
|
|
2771
2787
|
}
|
|
2788
|
+
logger;
|
|
2789
|
+
client;
|
|
2790
|
+
timeout;
|
|
2772
2791
|
/**
|
|
2773
2792
|
* Execute a full Docling conversion pipeline.
|
|
2774
2793
|
*
|
|
@@ -2931,6 +2950,7 @@ var ImagePdfConverter = class {
|
|
|
2931
2950
|
constructor(logger) {
|
|
2932
2951
|
this.logger = logger;
|
|
2933
2952
|
}
|
|
2953
|
+
logger;
|
|
2934
2954
|
/**
|
|
2935
2955
|
* Convert a PDF file to an image-based PDF.
|
|
2936
2956
|
* Downloads the PDF from URL, converts it using ImageMagick, and returns the path.
|
|
@@ -3415,6 +3435,7 @@ var PostDoclingPageProcessor = class {
|
|
|
3415
3435
|
constructor(logger) {
|
|
3416
3436
|
this.logger = logger;
|
|
3417
3437
|
}
|
|
3438
|
+
logger;
|
|
3418
3439
|
/**
|
|
3419
3440
|
* Read DoclingDocument from output directory, correct text via VLM,
|
|
3420
3441
|
* and save the corrected document back.
|
|
@@ -5221,6 +5242,8 @@ var ImageRegionSnapper = class {
|
|
|
5221
5242
|
this.logger = logger;
|
|
5222
5243
|
this.options = options;
|
|
5223
5244
|
}
|
|
5245
|
+
logger;
|
|
5246
|
+
options;
|
|
5224
5247
|
async snap(pageImagePath, pageSize, bbox) {
|
|
5225
5248
|
const warnings = [];
|
|
5226
5249
|
const dims = await this.getImageDimensions(pageImagePath);
|
|
@@ -5433,6 +5456,8 @@ var PictureSplitCandidateDetector = class {
|
|
|
5433
5456
|
this.options = options;
|
|
5434
5457
|
this.snapper = snapper ?? new ImageRegionSnapper(logger);
|
|
5435
5458
|
}
|
|
5459
|
+
logger;
|
|
5460
|
+
options;
|
|
5436
5461
|
snapper;
|
|
5437
5462
|
async detect(input) {
|
|
5438
5463
|
if (!this.isLargeEnoughForInspection(input.pictureBbox)) {
|
|
@@ -5734,6 +5759,9 @@ var ReviewAssistanceCheckpointStore = class _ReviewAssistanceCheckpointStore {
|
|
|
5734
5759
|
this.checkpoint = checkpoint;
|
|
5735
5760
|
this.now = now;
|
|
5736
5761
|
}
|
|
5762
|
+
path;
|
|
5763
|
+
checkpoint;
|
|
5764
|
+
now;
|
|
5737
5765
|
static open(outputDir, runId, now) {
|
|
5738
5766
|
const path = join12(outputDir, CHECKPOINT_FILE);
|
|
5739
5767
|
const checkpoint = this.read(path, runId, now?.() ?? /* @__PURE__ */ new Date());
|
|
@@ -6107,6 +6135,7 @@ var ImageCropWriter = class {
|
|
|
6107
6135
|
this.logger = logger;
|
|
6108
6136
|
this.snapper = snapper ?? new ImageRegionSnapper(logger);
|
|
6109
6137
|
}
|
|
6138
|
+
logger;
|
|
6110
6139
|
snapper;
|
|
6111
6140
|
async writeCrop(input) {
|
|
6112
6141
|
const imagesDir = join13(input.outputDir, "images");
|
|
@@ -6229,6 +6258,7 @@ var ReviewAssistancePatcher = class {
|
|
|
6229
6258
|
this.snapper = new ImageRegionSnapper(logger);
|
|
6230
6259
|
this.cropWriter = new ImageCropWriter(logger, this.snapper);
|
|
6231
6260
|
}
|
|
6261
|
+
logger;
|
|
6232
6262
|
snapper;
|
|
6233
6263
|
cropWriter;
|
|
6234
6264
|
captionResolver = new OrphanCaptionResolver();
|
|
@@ -8640,6 +8670,7 @@ var ReviewAssistanceRunner = class {
|
|
|
8640
8670
|
constructor(logger) {
|
|
8641
8671
|
this.logger = logger;
|
|
8642
8672
|
}
|
|
8673
|
+
logger;
|
|
8643
8674
|
async analyzeAndSave(outputDir, reportId, modelResolver, options) {
|
|
8644
8675
|
this.emitProgress(options, {
|
|
8645
8676
|
substage: "review-assistance:prepare",
|
|
@@ -10550,6 +10581,7 @@ var PostDoclingCorrectionPipeline = class {
|
|
|
10550
10581
|
constructor(logger) {
|
|
10551
10582
|
this.logger = logger;
|
|
10552
10583
|
}
|
|
10584
|
+
logger;
|
|
10553
10585
|
wrapCallback(pdfPath, reportId, options, originalCallback, abortSignal) {
|
|
10554
10586
|
const correction = normalizePDFCorrectionOptions(options.correction);
|
|
10555
10587
|
return async (outputDir) => {
|
|
@@ -10656,6 +10688,10 @@ var PDFConverter = class {
|
|
|
10656
10688
|
this.enableImagePdfFallback = enableImagePdfFallback;
|
|
10657
10689
|
this.timeout = timeout;
|
|
10658
10690
|
}
|
|
10691
|
+
logger;
|
|
10692
|
+
client;
|
|
10693
|
+
enableImagePdfFallback;
|
|
10694
|
+
timeout;
|
|
10659
10695
|
documentTypeValidated = false;
|
|
10660
10696
|
/**
|
|
10661
10697
|
* Validate that the PDF is an archaeological investigation report.
|