@heripo/pdf-parser 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Support. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 heripo lab
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,37 @@
1
+ @heripo/pdf-parser
2
+ Copyright 2026 heripo lab
3
+
4
+ This product includes software developed at
5
+ heripo lab (https://github.com/heripo-lab).
6
+
7
+ ================================================================================
8
+
9
+ This product includes Docling developed by International Business Machines
10
+ Corporation (IBM).
11
+
12
+ Docling
13
+ Copyright 2024 International Business Machines Corporation
14
+
15
+ Licensed under the MIT License:
16
+
17
+ MIT License
18
+
19
+ Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ of this software and associated documentation files (the "Software"), to deal
21
+ in the Software without restriction, including without limitation the rights
22
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ copies of the Software, and to permit persons to whom the Software is
24
+ furnished to do so, subject to the following conditions:
25
+
26
+ The above copyright notice and this permission notice shall be included in all
27
+ copies or substantial portions of the Software.
28
+
29
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
+ SOFTWARE.
36
+
37
+ Source: https://github.com/docling-project/docling
package/README.ko.md ADDED
@@ -0,0 +1,426 @@
1
+ # @heripo/pdf-parser
2
+
3
+ > PDF 파싱 라이브러리 - Docling SDK를 활용한 OCR 지원
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@heripo/pdf-parser.svg)](https://www.npmjs.com/package/@heripo/pdf-parser)
6
+ [![Node.js](https://img.shields.io/badge/Node.js-%3E%3D22-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
7
+ [![Python](https://img.shields.io/badge/Python-3.9--3.12-3776AB?logo=python&logoColor=white)](https://www.python.org/)
8
+ ![coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)
9
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](../../LICENSE)
10
+
11
+ [English](./README.md) | **한국어**
12
+
13
+ > **참고**: 프로젝트 전체 개요, 설치 방법, 로드맵은 [루트 README](../../README.ko.md)를 먼저 확인해 주세요.
14
+
15
+ `@heripo/pdf-parser`는 Docling SDK를 기반으로 PDF 문서를 파싱하고 OCR 처리하는 라이브러리입니다. 고고학 발굴조사보고서와 같은 복잡한 레이아웃의 문서를 효과적으로 처리할 수 있도록 설계되었습니다.
16
+
17
+ ## 목차
18
+
19
+ - [주요 기능](#주요-기능)
20
+ - [사전 요구사항](#사전-요구사항)
21
+ - [설치](#설치)
22
+ - [사용법](#사용법)
23
+ - [왜 macOS 전용인가?](#왜-macos-전용인가)
24
+ - [시스템 의존성 상세](#시스템-의존성-상세)
25
+ - [API 문서](#api-문서)
26
+ - [문제 해결](#문제-해결)
27
+ - [라이선스](#라이선스)
28
+
29
+ ## 주요 기능
30
+
31
+ - **고품질 OCR**: Docling SDK를 활용한 문서 인식
32
+ - **Apple Silicon 최적화**: M1/M2/M3/M4/M5 칩에서 GPU 가속 지원
33
+ - **자동 환경 설정**: Python 가상환경 및 docling-serve 자동 설치
34
+ - **이미지 추출**: PDF 내 이미지 자동 추출 및 저장
35
+ - **유연한 설정**: OCR, 포맷, 스레딩 옵션 등 세부 설정 가능
36
+
37
+ ## 사전 요구사항
38
+
39
+ ### 시스템 요구사항
40
+
41
+ - **macOS** with Apple Silicon (M1/M2/M3) - 최적 성능을 위해 권장
42
+ - **macOS** with Intel - 지원되지만 속도가 느림
43
+ - **Linux/Windows** - 현재 지원하지 않음
44
+
45
+ ### 필수 의존성
46
+
47
+ #### 1. Node.js >= 22.0.0
48
+
49
+ ```bash
50
+ brew install node
51
+ ```
52
+
53
+ #### 2. pnpm >= 9.0.0
54
+
55
+ ```bash
56
+ npm install -g pnpm
57
+ ```
58
+
59
+ #### 3. Python 3.9 - 3.12
60
+
61
+ ⚠️ **중요**: Python 3.13+는 지원하지 않습니다. Docling SDK의 일부 의존성이 Python 3.13과 호환되지 않습니다.
62
+
63
+ ```bash
64
+ # Python 3.11 설치 (권장)
65
+ brew install python@3.11
66
+
67
+ # 버전 확인
68
+ python3.11 --version
69
+ ```
70
+
71
+ #### 4. jq (JSON 처리 도구)
72
+
73
+ ```bash
74
+ brew install jq
75
+ ```
76
+
77
+ #### 5. lsof (포트 관리)
78
+
79
+ macOS에 기본적으로 설치되어 있습니다. 확인:
80
+
81
+ ```bash
82
+ which lsof
83
+ ```
84
+
85
+ ### 최초 실행 설정
86
+
87
+ `@heripo/pdf-parser`를 처음 사용할 때 자동으로:
88
+
89
+ 1. `~/.heripo/pdf-parser/venv`에 Python 가상환경 생성
90
+ 2. `docling-serve` 및 의존성 설치
91
+ 3. 로컬 포트에서 docling-serve 프로세스 시작
92
+
93
+ 이 설정은 한 번만 수행되며 인터넷 연결 상태에 따라 5-10분 정도 소요될 수 있습니다.
94
+
95
+ ## 설치
96
+
97
+ ```bash
98
+ # npm으로 설치
99
+ npm install @heripo/pdf-parser
100
+
101
+ # pnpm으로 설치
102
+ pnpm add @heripo/pdf-parser
103
+
104
+ # yarn으로 설치
105
+ yarn add @heripo/pdf-parser
106
+ ```
107
+
108
+ ## 사용법
109
+
110
+ ### 기본 사용법
111
+
112
+ ```typescript
113
+ import { Logger } from '@heripo/logger';
114
+ import { PDFParser } from '@heripo/pdf-parser';
115
+
116
+ const logger = Logger(...);
117
+
118
+ // PDFParser 인스턴스 생성
119
+ const pdfParser = new PDFParser({
120
+ pythonPath: 'python3.11', // Python 실행 경로
121
+ logger,
122
+ });
123
+
124
+ // 초기화 (환경 설정 및 docling-serve 시작)
125
+ await pdfParser.init();
126
+
127
+ // PDF 파싱
128
+ const outputPath = await pdfParser.parse(
129
+ 'path/to/report.pdf', // 입력 PDF 파일
130
+ 'output-directory', // 출력 디렉토리
131
+ (resultPath) => {
132
+ // 변환 완료 콜백
133
+ console.log('PDF 변환 완료:', resultPath);
134
+ },
135
+ );
136
+
137
+ // 결과 사용
138
+ console.log('출력 경로:', outputPath);
139
+ ```
140
+
141
+ ### 고급 옵션
142
+
143
+ ```typescript
144
+ const pdfParser = new PDFParser({
145
+ pythonPath: 'python3.11',
146
+ logger,
147
+
148
+ // docling-serve 설정
149
+ port: 5001, // 사용할 포트 (기본값: 5001)
150
+ timeout: 10000000, // 타임아웃 (밀리초)
151
+
152
+ // 외부 docling-serve 사용
153
+ externalDoclingUrl: 'http://localhost:5000', // 외부 서버 사용 시
154
+ });
155
+
156
+ // 변환 옵션 지정
157
+ await pdfParser.parse('input.pdf', 'output', (result) => console.log(result), {
158
+ // OCR 설정
159
+ doOcr: true, // OCR 활성화 (기본값: true)
160
+
161
+ // 출력 포맷
162
+ formats: ['docling_json', 'md'], // 출력 형식 선택
163
+
164
+ // 스레드 수
165
+ pdfBackend: 'dlparse_v2', // PDF 백엔드
166
+ });
167
+ ```
168
+
169
+ ### 이미지 추출
170
+
171
+ PDF에서 이미지를 자동으로 추출합니다:
172
+
173
+ ```typescript
174
+ const outputPath = await pdfParser.parse(
175
+ 'report.pdf',
176
+ 'output',
177
+ (resultPath) => {
178
+ // 이미지는 output/images/ 디렉토리에 저장됨
179
+ console.log('이미지 추출 완료:', resultPath);
180
+ },
181
+ );
182
+ ```
183
+
184
+ ### 리소스 정리
185
+
186
+ 작업 완료 후 리소스를 정리합니다:
187
+
188
+ ```typescript
189
+ // docling-serve 프로세스 종료
190
+ await pdfParser.shutdown();
191
+ ```
192
+
193
+ ## 왜 macOS 전용인가?
194
+
195
+ `@heripo/pdf-parser`는 **의도적으로 macOS에 강하게 의존**합니다. 이 결정의 핵심 이유는 **Docling SDK의 로컬 OCR 성능**입니다.
196
+
197
+ ### OCR 선택 배경
198
+
199
+ 고고학 발굴조사보고서 PDF는 다음과 같은 특성이 있습니다:
200
+
201
+ - 수백 페이지 분량의 스캔 문서
202
+ - 복잡한 표, 도면, 사진이 포함된 레이아웃
203
+ - 정밀한 텍스트 추출이 필수적
204
+
205
+ ### OCR 옵션 비교
206
+
207
+ | 방식 | 성능 | 비용 | 설명 |
208
+ | ----------------------- | ----- | ---- | --------------------------------------- |
209
+ | **Docling (로컬)** | ★★★★★ | 무료 | Apple Silicon에서 압도적 성능, GPU 활용 |
210
+ | Cloud OCR (Google, AWS) | ★★★★ | $$$ | 수백 페이지당 수십 달러 |
211
+ | Tesseract (로컬) | ★★ | 무료 | 한국어 인식률 낮음, 레이아웃 분석 부족 |
212
+
213
+ ### 핵심 장점
214
+
215
+ - **비용**: 클라우드 OCR 대비 100배 이상 저렴 (무료)
216
+ - **성능**: Apple Silicon M1/M2/M3에서 GPU 가속으로 빠른 처리
217
+ - **품질**: 복잡한 레이아웃의 문서도 정확히 인식
218
+ - **프라이버시**: 문서가 외부 서버로 전송되지 않음
219
+
220
+ ### Trade-off
221
+
222
+ - macOS + Apple Silicon 환경에서만 최적 성능
223
+ - Linux/Windows 지원은 현재 계획 없음 (아래 "Linux 지원 현황" 참고)
224
+
225
+ ## 시스템 의존성 상세
226
+
227
+ `@heripo/pdf-parser`는 다음 시스템 레벨 의존성이 필요합니다:
228
+
229
+ | 의존성 | 필수 버전 | 설치 방법 | 용도 |
230
+ | ------ | ---------- | -------------------------- | -------------------------- |
231
+ | Python | 3.9 - 3.12 | `brew install python@3.11` | Docling SDK 실행 환경 |
232
+ | jq | Any | `brew install jq` | JSON 처리 (변환 결과 파싱) |
233
+ | lsof | Any | macOS 기본 설치됨 | docling-serve 포트 관리 |
234
+
235
+ > ⚠️ **Python 3.13+는 지원하지 않습니다.** Docling SDK의 일부 의존성이 Python 3.13과 호환되지 않습니다.
236
+
237
+ ### Python 버전 확인
238
+
239
+ ```bash
240
+ # 설치된 Python 버전 확인
241
+ python3 --version
242
+ python3.11 --version
243
+
244
+ # 여러 버전이 설치된 경우
245
+ ls -la /usr/local/bin/python*
246
+ ```
247
+
248
+ ### jq 설치 확인
249
+
250
+ ```bash
251
+ # jq 버전 확인
252
+ jq --version
253
+
254
+ # jq 경로 확인
255
+ which jq
256
+ ```
257
+
258
+ ## API 문서
259
+
260
+ ### PDFParser 클래스
261
+
262
+ #### 생성자 옵션
263
+
264
+ ```typescript
265
+ interface PDFParserOptions {
266
+ pythonPath?: string; // Python 실행 경로 (기본값: 'python3')
267
+ logger?: Logger; // 로거 인스턴스
268
+ port?: number; // docling-serve 포트 (기본값: 5001)
269
+ timeout?: number; // 타임아웃 (밀리초, 기본값: 10000000)
270
+ externalDoclingUrl?: string; // 외부 docling-serve URL (선택)
271
+ }
272
+ ```
273
+
274
+ #### 메서드
275
+
276
+ ##### `init(): Promise<void>`
277
+
278
+ Python 환경을 설정하고 docling-serve를 시작합니다.
279
+
280
+ ```typescript
281
+ await pdfParser.init();
282
+ ```
283
+
284
+ ##### `parse(inputPath, outputDir, callback, options?): Promise<string>`
285
+
286
+ PDF 파일을 파싱합니다.
287
+
288
+ **파라미터:**
289
+
290
+ - `inputPath` (string): 입력 PDF 파일 경로
291
+ - `outputDir` (string): 출력 디렉토리 경로
292
+ - `callback` (function): 변환 완료 시 호출될 콜백 함수
293
+ - `options` (ConversionOptions, 선택): 변환 옵션
294
+
295
+ **반환값:**
296
+
297
+ - `Promise<string>`: 출력 파일 경로
298
+
299
+ ##### `shutdown(): Promise<void>`
300
+
301
+ docling-serve 프로세스를 종료합니다.
302
+
303
+ ```typescript
304
+ await pdfParser.shutdown();
305
+ ```
306
+
307
+ ### ConversionOptions
308
+
309
+ ```typescript
310
+ interface ConversionOptions {
311
+ doOcr?: boolean; // OCR 활성화 (기본값: true)
312
+ formats?: string[]; // 출력 형식 (기본값: ['docling_json'])
313
+ pdfBackend?: string; // PDF 백엔드 (기본값: 'dlparse_v2')
314
+ }
315
+ ```
316
+
317
+ ## 문제 해결
318
+
319
+ ### Python 버전 오류
320
+
321
+ **증상**: `Python version X.Y is not supported`
322
+
323
+ **해결**:
324
+
325
+ ```bash
326
+ # Python 3.11 설치
327
+ brew install python@3.11
328
+
329
+ # PDFParser에 명시적으로 지정
330
+ const pdfParser = new PDFParser({
331
+ pythonPath: 'python3.11',
332
+ logger,
333
+ });
334
+ ```
335
+
336
+ ### jq를 찾을 수 없음
337
+
338
+ **증상**: `Command not found: jq`
339
+
340
+ **해결**:
341
+
342
+ ```bash
343
+ brew install jq
344
+ ```
345
+
346
+ ### 포트 충돌
347
+
348
+ **증상**: `Port 5001 is already in use`
349
+
350
+ **해결**:
351
+
352
+ ```bash
353
+ # 다른 포트 사용
354
+ const pdfParser = new PDFParser({
355
+ pythonPath: 'python3.11',
356
+ port: 5002, // 다른 포트 지정
357
+ logger,
358
+ });
359
+ ```
360
+
361
+ ### docling-serve 시작 실패
362
+
363
+ **증상**: `Failed to start docling-serve`
364
+
365
+ **해결**:
366
+
367
+ ```bash
368
+ # 가상환경 재생성
369
+ rm -rf ~/.heripo/pdf-parser/venv
370
+ # 다시 init() 실행
371
+ ```
372
+
373
+ ## Linux 지원 현황
374
+
375
+ 현재 **macOS 전용**입니다. Linux 지원은 **완전히 배제한 것은 아니지만**, OCR 성능과 비용 효율성 문제로 **현재는 구체적인 계획이 없습니다**.
376
+
377
+ | 플랫폼 | 상태 | 비고 |
378
+ | --------------------- | ------- | ------------------------------- |
379
+ | macOS + Apple Silicon | ✅ 지원 | 최적 성능, GPU 가속 |
380
+ | macOS + Intel | ✅ 지원 | GPU 가속 없음 |
381
+ | Linux | ❓ 미정 | 성능/비용 문제로 현재 계획 없음 |
382
+ | Windows | ❓ 미정 | WSL2 통한 Linux 방식 고려 가능 |
383
+
384
+ ### Linux 미지원 사유
385
+
386
+ Docling SDK의 로컬 OCR은 macOS에서 Apple Metal GPU 가속을 활용해 성능과 비용 효율성을 모두 달성합니다. Linux에서 동등한 성능과 비용 효율성을 제공하는 OCR 솔루션을 아직 찾지 못했습니다.
387
+
388
+ ### 아이디어 제안 환영
389
+
390
+ 성능과 비용을 모두 잡으면서 Linux를 지원할 수 있는 아이디어가 있다면, [GitHub Discussions](https://github.com/heripo-lab/heripo-engine/discussions) 또는 Issue로 제안해 주세요. 특히 다음과 같은 정보가 도움이 됩니다:
391
+
392
+ - Linux에서 한국어 문서 OCR 경험
393
+ - 복잡한 레이아웃(표, 도면) 처리 가능한 OCR 솔루션
394
+ - 수백 페이지 처리 시 비용 추산
395
+
396
+ ## 관련 패키지
397
+
398
+ - [@heripo/document-processor](../document-processor) - 문서 구조 분석 및 LLM 처리
399
+ - [@heripo/model](../model) - 데이터 모델 및 타입 정의
400
+
401
+ ## 라이선스
402
+
403
+ 이 패키지는 [Apache License 2.0](../../LICENSE) 라이선스 하에 배포됩니다.
404
+
405
+ ## 기여하기
406
+
407
+ 기여는 언제나 환영합니다! [기여 가이드](../../CONTRIBUTING.ko.md)를 참고하세요.
408
+
409
+ ## 이슈 및 지원
410
+
411
+ - **버그 리포트**: [GitHub Issues](https://github.com/heripo-lab/heripo-engine/issues)
412
+ - **토론**: [GitHub Discussions](https://github.com/heripo-lab/heripo-engine/discussions)
413
+ - **보안 취약점**: [보안 정책](../../SECURITY.ko.md) 참고
414
+
415
+ ## 프로젝트 전체 정보
416
+
417
+ 이 패키지에서 다루지 않는 프로젝트 전체 정보는 [루트 README](../../README.ko.md)에서 확인하세요:
418
+
419
+ - **인용 및 출처 표기**: 학술 인용(BibTeX) 및 출처 표기 방법
420
+ - **기여 가이드라인**: 개발 가이드라인, 커밋 규칙, PR 절차
421
+ - **커뮤니티**: 이슈 트래커, 토론, 보안 정책
422
+ - **로드맵**: 프로젝트 개발 계획
423
+
424
+ ---
425
+
426
+ **heripo lab** | [GitHub](https://github.com/heripo-lab) | [heripo engine](https://github.com/heripo-lab/heripo-engine)