@rhwp/core 0.6.0 → 0.7.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/README.md CHANGED
@@ -1,69 +1,259 @@
1
- # rhwp
1
+ # @rhwp/core
2
2
 
3
- **알(R), 모두의 한글** — HWP/HWPX 파일 파서 & 렌더러 (Rust + WebAssembly)
3
+ **알(R), 모두의 한글** — 브라우저에서 HWP 파일을 열어보세요
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/@rhwp/core)](https://www.npmjs.com/package/@rhwp/core)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
7
 
8
- ## 설치
8
+ Rust + WebAssembly 기반 HWP/HWPX 파서 & 렌더러입니다.
9
+ HWP 파일을 파싱하고 SVG로 렌더링하는 저수준 API를 제공합니다.
10
+
11
+ > 편집 기능(메뉴, 툴바, 서식)이 필요하면 **[@rhwp/editor](https://www.npmjs.com/package/@rhwp/editor)** 를 사용하세요.
12
+ > 3줄이면 완전한 HWP 에디터를 임베드할 수 있습니다.
13
+
14
+ | 패키지 | 용도 |
15
+ |--------|------|
16
+ | **@rhwp/core** (이 패키지) | WASM 파서/렌더러 — 직접 API 호출 |
17
+ | **@rhwp/editor** | 완전한 에디터 UI — iframe 임베드 |
18
+
19
+ ## 빠른 시작 — 처음부터 따라하기
20
+
21
+ ### 1. 프로젝트 생성
9
22
 
10
23
  ```bash
24
+ mkdir my-hwp-viewer
25
+ cd my-hwp-viewer
26
+ npm init -y
11
27
  npm install @rhwp/core
28
+ npm install vite --save-dev
29
+ ```
30
+
31
+ ### 2. WASM 파일 복사
32
+
33
+ `@rhwp/core`에 포함된 WASM 바이너리를 웹 서버가 제공할 수 있는 위치에 복사합니다.
34
+
35
+ ```bash
36
+ mkdir public
37
+ cp node_modules/@rhwp/core/rhwp_bg.wasm public/
38
+ ```
39
+
40
+ ### 3. HTML 작성 — `index.html`
41
+
42
+ ```html
43
+ <!DOCTYPE html>
44
+ <html lang="ko">
45
+ <head>
46
+ <meta charset="UTF-8" />
47
+ <title>HWP 뷰어</title>
48
+ </head>
49
+ <body>
50
+ <h1>HWP 뷰어</h1>
51
+ <input type="file" id="file-input" accept=".hwp,.hwpx" />
52
+ <p id="status">파일을 선택해주세요.</p>
53
+ <div id="viewer"></div>
54
+ <script type="module" src="/main.js"></script>
55
+ </body>
56
+ </html>
12
57
  ```
13
58
 
14
- ## 사용법
59
+ ### 4. JavaScript 작성 — `main.js`
15
60
 
16
61
  ```javascript
17
62
  import init, { HwpDocument } from '@rhwp/core';
18
63
 
19
- // WASM 초기화
20
- await init();
64
+ // 텍스트 폭 측정 함수 등록 (필수 — 아래 "왜 필요한가?" 참고)
65
+ let ctx = null;
66
+ let lastFont = '';
67
+ globalThis.measureTextWidth = (font, text) => {
68
+ if (!ctx) ctx = document.createElement('canvas').getContext('2d');
69
+ if (font !== lastFont) { ctx.font = font; lastFont = font; }
70
+ return ctx.measureText(text).width;
71
+ };
21
72
 
22
- // HWP 파일 로드
23
- const response = await fetch('document.hwp');
24
- const buffer = new Uint8Array(await response.arrayBuffer());
25
- const doc = HwpDocument.load(buffer, 'document.hwp');
73
+ // WASM 초기화
74
+ await init({ module_or_path: '/rhwp_bg.wasm' });
75
+ document.getElementById('status').textContent = '준비 완료!';
26
76
 
27
- // 문서 정보
28
- console.log(doc.pageCount);
77
+ // 파일 선택 시 렌더링
78
+ document.getElementById('file-input').addEventListener('change', async (e) => {
79
+ const file = e.target.files[0];
80
+ if (!file) return;
29
81
 
30
- // SVG 렌더링
31
- const svg = doc.renderPageToSvg(0); // 첫 번째 페이지
32
- document.getElementById('viewer').innerHTML = svg;
82
+ const buffer = new Uint8Array(await file.arrayBuffer());
83
+ const doc = new HwpDocument(buffer);
84
+
85
+ // SVG로 첫 페이지 렌더링
86
+ const svg = doc.renderPageSvg(0);
87
+ document.getElementById('viewer').innerHTML = svg;
88
+ document.getElementById('status').textContent =
89
+ `${file.name} — ${doc.pageCount()}페이지`;
90
+ });
33
91
  ```
34
92
 
35
- ## Canvas 렌더링
93
+ ### 5. 실행
94
+
95
+ ```bash
96
+ npx vite --port 3000
97
+ ```
98
+
99
+ 브라우저에서 `http://localhost:3000` 을 열고 HWP 파일을 선택하면 렌더링됩니다.
100
+
101
+ ## API
102
+
103
+ ### 초기화
36
104
 
37
105
  ```javascript
38
106
  import init, { HwpDocument } from '@rhwp/core';
107
+ await init({ module_or_path: '/rhwp_bg.wasm' });
108
+ ```
109
+
110
+ ### 문서 로드
39
111
 
40
- await init();
41
- const doc = HwpDocument.load(buffer, 'document.hwp');
112
+ ```javascript
113
+ // 파일 입력에서 로드
114
+ const doc = new HwpDocument(new Uint8Array(buffer));
42
115
 
43
- // Canvas에 렌더링
44
- const canvas = document.getElementById('canvas');
45
- const ctx = canvas.getContext('2d');
46
- doc.renderPageToCanvas(0, ctx, canvas.width, canvas.height);
116
+ // fetch로 로드
117
+ const resp = await fetch('/sample.hwp');
118
+ const doc = new HwpDocument(new Uint8Array(await resp.arrayBuffer()));
47
119
  ```
48
120
 
49
- ## 기능
121
+ ### SVG 렌더링
122
+
123
+ ```javascript
124
+ const svg = doc.renderPageSvg(0); // 첫 페이지
125
+ document.getElementById('viewer').innerHTML = svg;
126
+ ```
127
+
128
+ ### 페이지 네비게이션
129
+
130
+ ```javascript
131
+ const total = doc.pageCount();
132
+ for (let i = 0; i < total; i++) {
133
+ const svg = doc.renderPageSvg(i);
134
+ // ...
135
+ }
136
+ ```
137
+
138
+ ## 필수 설정: measureTextWidth
139
+
140
+ WASM 내부에서 텍스트 레이아웃(줄바꿈, 정렬 등)을 계산할 때
141
+ 브라우저의 Canvas 텍스트 측정 API가 필요합니다.
142
+ **WASM 초기화 전에 반드시 등록**해야 합니다.
143
+
144
+ ```javascript
145
+ let ctx = null;
146
+ let lastFont = '';
147
+ globalThis.measureTextWidth = (font, text) => {
148
+ if (!ctx) ctx = document.createElement('canvas').getContext('2d');
149
+ if (font !== lastFont) { ctx.font = font; lastFont = font; }
150
+ return ctx.measureText(text).width;
151
+ };
152
+ ```
153
+
154
+ ### 왜 필요한가?
155
+
156
+ HWP 문서의 텍스트 배치(줄바꿈 위치, 양쪽 정렬 간격)를 정확하게 계산하려면
157
+ 각 글자의 실제 렌더링 폭을 알아야 합니다.
158
+ WASM 내부에는 브라우저 폰트에 접근할 수 없으므로,
159
+ JavaScript의 `Canvas.measureText()`를 콜백으로 호출합니다.
160
+
161
+ ## 폰트 설정 가이드
162
+
163
+ ### SVG 렌더링과 폰트
164
+
165
+ `renderPageSvg()`가 생성하는 SVG는 CSS `font-family` 속성으로 폰트를 지정합니다.
166
+ HWP 문서에서 사용된 폰트(한컴바탕, HY명조 등)가 사용자 환경에 없으면 **글자가 대체 폰트로 표시**되어 줄 바꿈 위치나 글자 간격이 원본과 달라질 수 있습니다.
167
+
168
+ ### 권장: 오픈소스 폴백 폰트 로드
169
+
170
+ rhwp는 한컴 전용 폰트를 오픈소스 폰트로 자동 폴백합니다. 아래 폰트를 웹페이지에 로드하면 대부분의 HWP 문서를 원본에 가깝게 렌더링할 수 있습니다.
171
+
172
+ ```html
173
+ <!-- Google Fonts CDN -->
174
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;700&family=Noto+Serif+KR:wght@400;700&family=Nanum+Gothic&family=Nanum+Myeongjo&display=swap">
175
+ ```
176
+
177
+ 또는 셀프 호스팅:
178
+
179
+ ```css
180
+ @font-face {
181
+ font-family: 'Pretendard';
182
+ src: url('/fonts/Pretendard-Regular.woff2') format('woff2');
183
+ font-weight: 400;
184
+ }
185
+ @font-face {
186
+ font-family: 'Pretendard';
187
+ src: url('/fonts/Pretendard-Bold.woff2') format('woff2');
188
+ font-weight: 700;
189
+ }
190
+ ```
191
+
192
+ ### 폰트 폴백 매핑
193
+
194
+ rhwp가 SVG에 적용하는 자동 폴백 체인:
195
+
196
+ | HWP 원본 폰트 | 폴백 1 | 폴백 2 | 폴백 3 |
197
+ |--------------|--------|--------|--------|
198
+ | 한컴바탕, HY명조 | Noto Serif KR | 나눔명조 | serif |
199
+ | 한컴돋움, HY고딕 | Noto Sans KR | 나눔고딕 | sans-serif |
200
+ | 함초롬바탕 | Noto Serif KR | 나눔명조 | serif |
201
+ | 함초롬돋움 | Pretendard | Noto Sans KR | sans-serif |
202
+ | 맑은 고딕 | Pretendard | Noto Sans KR | sans-serif |
203
+ | Arial, Calibri | Pretendard | sans-serif | — |
204
+ | Times New Roman | Noto Serif KR | serif | — |
205
+ | 바탕, 궁서 | Noto Serif KR | serif | — |
206
+ | 돋움, 굴림 | Noto Sans KR | sans-serif | — |
207
+
208
+ ### 폰트 없이도 동작합니다
209
+
210
+ 폴백 폰트를 로드하지 않아도 SVG는 정상적으로 렌더링됩니다. 브라우저의 기본 serif/sans-serif 폰트가 사용되며, 글자 간격이 원본과 다소 다를 수 있습니다.
211
+
212
+ ## 지원 기능
50
213
 
51
214
  - **HWP 5.0** (바이너리) + **HWPX** (XML) 파싱
52
- - 문단, 표, 수식, 이미지, 차트 렌더링
53
- - 페이지네이션 (다단, 표 분할)
54
- - SVG / Canvas 출력
55
- - 머리말/꼬리말/바탕쪽/각주
215
+ - 문단, 표, 수식, 이미지, 차트, 도형 렌더링
216
+ - 페이지네이션 (다단, 표 분할)
217
+ - 그림 자르기(crop), 이미지 테두리선
218
+ - SVG 출력
219
+ - 머리말/꼬리말/바탕쪽/각주/미주
56
220
 
57
221
  ## 링크
58
222
 
59
- - [온라인 데모](https://edwardkim.github.io/rhwp/)
60
- - [GitHub](https://github.com/edwardkim/rhwp)
61
- - [VS Code 확장](https://marketplace.visualstudio.com/items?itemName=edwardkim.rhwp-vscode)
223
+ - **[온라인 데모](https://edwardkim.github.io/rhwp/)**
224
+ - **[GitHub](https://github.com/edwardkim/rhwp)**
225
+ - **[@rhwp/editor](https://www.npmjs.com/package/@rhwp/editor)** — 에디터 UI 임베드
226
+ - **[VS Code 확장](https://marketplace.visualstudio.com/items?itemName=edwardkim.rhwp-vscode)**
227
+
228
+ ## Third-Party Licenses
229
+
230
+ 이 패키지는 다음 오픈소스 Rust 크레이트를 WASM으로 컴파일하여 포함합니다.
231
+
232
+ | 크레이트 | 라이선스 |
233
+ |---------|---------|
234
+ | wasm-bindgen / web-sys / js-sys | MIT OR Apache-2.0 |
235
+ | quick-xml | MIT |
236
+ | cfb | MIT |
237
+ | flate2 | MIT OR Apache-2.0 |
238
+ | encoding_rs | (Apache-2.0 OR MIT) AND BSD-3-Clause |
239
+ | usvg / svg2pdf | Apache-2.0 OR MIT |
240
+ | pdf-writer | MIT OR Apache-2.0 |
241
+ | unicode-segmentation / unicode-width | MIT OR Apache-2.0 |
242
+ | image | MIT OR Apache-2.0 |
243
+
244
+ 전체 목록: [THIRD_PARTY_LICENSES.md](https://github.com/edwardkim/rhwp/blob/main/THIRD_PARTY_LICENSES.md)
245
+
246
+ > 모든 의존성은 MIT 라이선스와 호환됩니다.
62
247
 
63
248
  ## Notice
64
249
 
65
250
  본 제품은 한글과컴퓨터의 한글 문서 파일(.hwp) 공개 문서를 참고하여 개발하였습니다.
66
251
 
252
+ ## Trademark
253
+
254
+ "한글", "한컴", "HWP", "HWPX"는 주식회사 한글과컴퓨터의 등록 상표입니다.
255
+ 본 패키지는 한글과컴퓨터와 제휴, 후원, 승인 관계가 없는 독립적인 오픈소스 프로젝트입니다.
256
+
67
257
  ## License
68
258
 
69
259
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhwp/core",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "HWP/HWPX file parser and renderer — Rust + WebAssembly",
5
5
  "type": "module",
6
6
  "main": "rhwp.js",
package/rhwp.d.ts CHANGED
@@ -1207,6 +1207,14 @@ export class HwpViewer {
1207
1207
  visiblePages(): Uint32Array;
1208
1208
  }
1209
1209
 
1210
+ /**
1211
+ * HWP 파일에서 썸네일 이미지만 경량 추출 (전체 파싱 없이)
1212
+ *
1213
+ * 반환: JSON `{ "format": "png"|"gif", "base64": "...", "width": N, "height": N }`
1214
+ * PrvImage가 없으면 `null` 반환
1215
+ */
1216
+ export function extractThumbnail(data: Uint8Array): any;
1217
+
1210
1218
  /**
1211
1219
  * WASM panic hook 초기화 (한 번만 실행)
1212
1220
  */
@@ -1218,8 +1226,11 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
1218
1226
 
1219
1227
  export interface InitOutput {
1220
1228
  readonly memory: WebAssembly.Memory;
1229
+ readonly version: () => [number, number];
1230
+ readonly init_panic_hook: () => void;
1221
1231
  readonly __wbg_hwpdocument_free: (a: number, b: number) => void;
1222
1232
  readonly __wbg_hwpviewer_free: (a: number, b: number) => void;
1233
+ readonly extractThumbnail: (a: number, b: number) => any;
1223
1234
  readonly hwpdocument_addBookmark: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
1224
1235
  readonly hwpdocument_applyCellStyle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
1225
1236
  readonly hwpdocument_applyCharFormat: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
@@ -1458,8 +1469,6 @@ export interface InitOutput {
1458
1469
  readonly hwpviewer_updateViewport: (a: number, b: number, c: number, d: number, e: number) => void;
1459
1470
  readonly hwpviewer_visiblePages: (a: number) => [number, number];
1460
1471
  readonly hwpviewer_pageCount: (a: number) => number;
1461
- readonly version: () => [number, number];
1462
- readonly init_panic_hook: () => void;
1463
1472
  readonly __wbindgen_exn_store: (a: number) => void;
1464
1473
  readonly __externref_table_alloc: () => number;
1465
1474
  readonly __wbindgen_externrefs: WebAssembly.Table;
package/rhwp.js CHANGED
@@ -5561,6 +5561,21 @@ export class HwpViewer {
5561
5561
  }
5562
5562
  if (Symbol.dispose) HwpViewer.prototype[Symbol.dispose] = HwpViewer.prototype.free;
5563
5563
 
5564
+ /**
5565
+ * HWP 파일에서 썸네일 이미지만 경량 추출 (전체 파싱 없이)
5566
+ *
5567
+ * 반환: JSON `{ "format": "png"|"gif", "base64": "...", "width": N, "height": N }`
5568
+ * PrvImage가 없으면 `null` 반환
5569
+ * @param {Uint8Array} data
5570
+ * @returns {any}
5571
+ */
5572
+ export function extractThumbnail(data) {
5573
+ const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
5574
+ const len0 = WASM_VECTOR_LEN;
5575
+ const ret = wasm.extractThumbnail(ptr0, len0);
5576
+ return ret;
5577
+ }
5578
+
5564
5579
  /**
5565
5580
  * WASM panic hook 초기화 (한 번만 실행)
5566
5581
  */
@@ -5583,69 +5598,68 @@ export function version() {
5583
5598
  wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
5584
5599
  }
5585
5600
  }
5586
-
5587
5601
  function __wbg_get_imports() {
5588
5602
  const import0 = {
5589
5603
  __proto__: null,
5590
- __wbg___wbindgen_is_undefined_c0cca72b82b86f4d: function(arg0) {
5604
+ __wbg___wbindgen_is_undefined_29a43b4d42920abd: function(arg0) {
5591
5605
  const ret = arg0 === undefined;
5592
5606
  return ret;
5593
5607
  },
5594
- __wbg___wbindgen_throw_81fc77679af83bc6: function(arg0, arg1) {
5608
+ __wbg___wbindgen_throw_6b64449b9b9ed33c: function(arg0, arg1) {
5595
5609
  throw new Error(getStringFromWasm0(arg0, arg1));
5596
5610
  },
5597
- __wbg_addColorStop_7838a3cd5e06abf1: function() { return handleError(function (arg0, arg1, arg2, arg3) {
5611
+ __wbg_addColorStop_e4af4b30913e9aa4: function() { return handleError(function (arg0, arg1, arg2, arg3) {
5598
5612
  arg0.addColorStop(arg1, getStringFromWasm0(arg2, arg3));
5599
5613
  }, arguments); },
5600
- __wbg_arcTo_4952f0a643175f27: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
5614
+ __wbg_arcTo_941456c2ac39464e: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
5601
5615
  arg0.arcTo(arg1, arg2, arg3, arg4, arg5);
5602
5616
  }, arguments); },
5603
- __wbg_arc_a01205d471446260: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
5617
+ __wbg_arc_817de096f286078c: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
5604
5618
  arg0.arc(arg1, arg2, arg3, arg4, arg5);
5605
5619
  }, arguments); },
5606
- __wbg_beginPath_a1e53d163e17614b: function(arg0) {
5620
+ __wbg_beginPath_6d95cc267dd3e88f: function(arg0) {
5607
5621
  arg0.beginPath();
5608
5622
  },
5609
- __wbg_bezierCurveTo_efe5b7b8358a89ec: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
5623
+ __wbg_bezierCurveTo_ee45420e339643c8: function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
5610
5624
  arg0.bezierCurveTo(arg1, arg2, arg3, arg4, arg5, arg6);
5611
5625
  },
5612
- __wbg_clip_5451abac85dafc5b: function(arg0) {
5626
+ __wbg_clip_650afbf402c47658: function(arg0) {
5613
5627
  arg0.clip();
5614
5628
  },
5615
- __wbg_closePath_2995ab1cdf3f4741: function(arg0) {
5629
+ __wbg_closePath_d9cf40637e9c89c2: function(arg0) {
5616
5630
  arg0.closePath();
5617
5631
  },
5618
- __wbg_complete_9c7e8398a74ac445: function(arg0) {
5632
+ __wbg_complete_7d890334bda9075e: function(arg0) {
5619
5633
  const ret = arg0.complete;
5620
5634
  return ret;
5621
5635
  },
5622
- __wbg_createElement_8640e331213b402e: function() { return handleError(function (arg0, arg1, arg2) {
5636
+ __wbg_createElement_bbd4c90086fe6f7b: function() { return handleError(function (arg0, arg1, arg2) {
5623
5637
  const ret = arg0.createElement(getStringFromWasm0(arg1, arg2));
5624
5638
  return ret;
5625
5639
  }, arguments); },
5626
- __wbg_createLinearGradient_ab028d15952b6091: function(arg0, arg1, arg2, arg3, arg4) {
5640
+ __wbg_createLinearGradient_1ecf06dc64e02f68: function(arg0, arg1, arg2, arg3, arg4) {
5627
5641
  const ret = arg0.createLinearGradient(arg1, arg2, arg3, arg4);
5628
5642
  return ret;
5629
5643
  },
5630
- __wbg_createPattern_717efe2bd2276276: function() { return handleError(function (arg0, arg1, arg2, arg3) {
5644
+ __wbg_createPattern_665dd581add98e15: function() { return handleError(function (arg0, arg1, arg2, arg3) {
5631
5645
  const ret = arg0.createPattern(arg1, getStringFromWasm0(arg2, arg3));
5632
5646
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
5633
5647
  }, arguments); },
5634
- __wbg_createRadialGradient_fec727ae86035c9d: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
5648
+ __wbg_createRadialGradient_9c24ef9b8a6ce72f: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
5635
5649
  const ret = arg0.createRadialGradient(arg1, arg2, arg3, arg4, arg5, arg6);
5636
5650
  return ret;
5637
5651
  }, arguments); },
5638
- __wbg_document_a28a21ae315de4ea: function(arg0) {
5652
+ __wbg_document_7a41071f2f439323: function(arg0) {
5639
5653
  const ret = arg0.document;
5640
5654
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
5641
5655
  },
5642
- __wbg_drawImage_6fc7a96d344d7199: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
5643
- arg0.drawImage(arg1, arg2, arg3, arg4, arg5);
5644
- }, arguments); },
5645
- __wbg_drawImage_b315346e733a5afb: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
5656
+ __wbg_drawImage_556ab1ffc4c5c68d: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) {
5646
5657
  arg0.drawImage(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
5647
5658
  }, arguments); },
5648
- __wbg_ellipse_9a16e4a09b67f93b: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
5659
+ __wbg_drawImage_96e533f015039596: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
5660
+ arg0.drawImage(arg1, arg2, arg3, arg4, arg5);
5661
+ }, arguments); },
5662
+ __wbg_ellipse_0303410b3d05bb97: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) {
5649
5663
  arg0.ellipse(arg1, arg2, arg3, arg4, arg5, arg6, arg7);
5650
5664
  }, arguments); },
5651
5665
  __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
@@ -5659,24 +5673,24 @@ function __wbg_get_imports() {
5659
5673
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
5660
5674
  }
5661
5675
  },
5662
- __wbg_fillRect_a7f9306dd4dccb50: function(arg0, arg1, arg2, arg3, arg4) {
5676
+ __wbg_fillRect_992c5a4646ea7a7f: function(arg0, arg1, arg2, arg3, arg4) {
5663
5677
  arg0.fillRect(arg1, arg2, arg3, arg4);
5664
5678
  },
5665
- __wbg_fillText_74f2fec94a63d2bb: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
5679
+ __wbg_fillText_dabb33ea287042e2: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
5666
5680
  arg0.fillText(getStringFromWasm0(arg1, arg2), arg3, arg4);
5667
5681
  }, arguments); },
5668
- __wbg_fill_f32839c7afadf949: function(arg0) {
5682
+ __wbg_fill_ec5da5f3916cf924: function(arg0) {
5669
5683
  arg0.fill();
5670
5684
  },
5671
- __wbg_getContext_8f1ff363618c55da: function() { return handleError(function (arg0, arg1, arg2) {
5685
+ __wbg_getContext_fc146f8ec021d074: function() { return handleError(function (arg0, arg1, arg2) {
5672
5686
  const ret = arg0.getContext(getStringFromWasm0(arg1, arg2));
5673
5687
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
5674
5688
  }, arguments); },
5675
- __wbg_height_734034c3ff2654af: function(arg0) {
5689
+ __wbg_height_528848d067cc2221: function(arg0) {
5676
5690
  const ret = arg0.height;
5677
5691
  return ret;
5678
5692
  },
5679
- __wbg_instanceof_CanvasRenderingContext2d_f09a103e0ca31fb4: function(arg0) {
5693
+ __wbg_instanceof_CanvasRenderingContext2d_24a3fe06e62b98d7: function(arg0) {
5680
5694
  let result;
5681
5695
  try {
5682
5696
  result = arg0 instanceof CanvasRenderingContext2D;
@@ -5686,7 +5700,7 @@ function __wbg_get_imports() {
5686
5700
  const ret = result;
5687
5701
  return ret;
5688
5702
  },
5689
- __wbg_instanceof_HtmlCanvasElement_3cec11b30b0d54e4: function(arg0) {
5703
+ __wbg_instanceof_HtmlCanvasElement_ea4dfc3bb77c734b: function(arg0) {
5690
5704
  let result;
5691
5705
  try {
5692
5706
  result = arg0 instanceof HTMLCanvasElement;
@@ -5696,7 +5710,7 @@ function __wbg_get_imports() {
5696
5710
  const ret = result;
5697
5711
  return ret;
5698
5712
  },
5699
- __wbg_instanceof_Window_c0fee4c064502536: function(arg0) {
5713
+ __wbg_instanceof_Window_cc64c86c8ef9e02b: function(arg0) {
5700
5714
  let result;
5701
5715
  try {
5702
5716
  result = arg0 instanceof Window;
@@ -5706,17 +5720,17 @@ function __wbg_get_imports() {
5706
5720
  const ret = result;
5707
5721
  return ret;
5708
5722
  },
5709
- __wbg_lineTo_7681b84260d7196b: function(arg0, arg1, arg2) {
5723
+ __wbg_lineTo_c9f1e0dd4824ae31: function(arg0, arg1, arg2) {
5710
5724
  arg0.lineTo(arg1, arg2);
5711
5725
  },
5712
- __wbg_measureTextWidth_8a74d4420413fe6e: function(arg0, arg1, arg2, arg3) {
5726
+ __wbg_measureTextWidth_1fba8c01a653f4c4: function(arg0, arg1, arg2, arg3) {
5713
5727
  const ret = globalThis.measureTextWidth(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
5714
5728
  return ret;
5715
5729
  },
5716
- __wbg_moveTo_cddeee6b0d0c4ef5: function(arg0, arg1, arg2) {
5730
+ __wbg_moveTo_d3deaceb55dc2d80: function(arg0, arg1, arg2) {
5717
5731
  arg0.moveTo(arg1, arg2);
5718
5732
  },
5719
- __wbg_naturalWidth_bd04449177fd0c7b: function(arg0) {
5733
+ __wbg_naturalWidth_901815552da8b0fc: function(arg0) {
5720
5734
  const ret = arg0.naturalWidth;
5721
5735
  return ret;
5722
5736
  },
@@ -5724,88 +5738,88 @@ function __wbg_get_imports() {
5724
5738
  const ret = new Error();
5725
5739
  return ret;
5726
5740
  },
5727
- __wbg_new_84748f0feee3d22f: function() { return handleError(function () {
5728
- const ret = new Image();
5729
- return ret;
5730
- }, arguments); },
5731
- __wbg_new_f3c9df4f38f3f798: function() {
5741
+ __wbg_new_682678e2f47e32bc: function() {
5732
5742
  const ret = new Array();
5733
5743
  return ret;
5734
5744
  },
5735
- __wbg_push_6bdbc990be5ac37b: function(arg0, arg1) {
5745
+ __wbg_new_ca878e5fdbbbf099: function() { return handleError(function () {
5746
+ const ret = new Image();
5747
+ return ret;
5748
+ }, arguments); },
5749
+ __wbg_push_471a5b068a5295f6: function(arg0, arg1) {
5736
5750
  const ret = arg0.push(arg1);
5737
5751
  return ret;
5738
5752
  },
5739
- __wbg_quadraticCurveTo_80a0cac31f3c97d5: function(arg0, arg1, arg2, arg3, arg4) {
5753
+ __wbg_quadraticCurveTo_37ac65747b2aa9f4: function(arg0, arg1, arg2, arg3, arg4) {
5740
5754
  arg0.quadraticCurveTo(arg1, arg2, arg3, arg4);
5741
5755
  },
5742
- __wbg_rect_a62412d60d0bcfe7: function(arg0, arg1, arg2, arg3, arg4) {
5756
+ __wbg_rect_a7f5a58f447e85c2: function(arg0, arg1, arg2, arg3, arg4) {
5743
5757
  arg0.rect(arg1, arg2, arg3, arg4);
5744
5758
  },
5745
- __wbg_restore_512447a0078b165e: function(arg0) {
5759
+ __wbg_restore_f103803ad0dc390b: function(arg0) {
5746
5760
  arg0.restore();
5747
5761
  },
5748
- __wbg_rotate_900633026d37af8d: function() { return handleError(function (arg0, arg1) {
5762
+ __wbg_rotate_fb8a7a0e39ad85a6: function() { return handleError(function (arg0, arg1) {
5749
5763
  arg0.rotate(arg1);
5750
5764
  }, arguments); },
5751
- __wbg_save_a345c60472a6c85a: function(arg0) {
5765
+ __wbg_save_5b07d6d1028c3e4d: function(arg0) {
5752
5766
  arg0.save();
5753
5767
  },
5754
- __wbg_scale_d80ed0b793d7a928: function() { return handleError(function (arg0, arg1, arg2) {
5768
+ __wbg_scale_c41a145cbdf9e3c0: function() { return handleError(function (arg0, arg1, arg2) {
5755
5769
  arg0.scale(arg1, arg2);
5756
5770
  }, arguments); },
5757
- __wbg_setLineDash_1efc2f7f902aa644: function() { return handleError(function (arg0, arg1) {
5771
+ __wbg_setLineDash_c273ecd8ca7d242d: function() { return handleError(function (arg0, arg1) {
5758
5772
  arg0.setLineDash(arg1);
5759
5773
  }, arguments); },
5760
- __wbg_set_fillStyle_06ca63831e299ec6: function(arg0, arg1, arg2) {
5761
- arg0.fillStyle = getStringFromWasm0(arg1, arg2);
5762
- },
5763
- __wbg_set_fillStyle_7020c23cef17ae89: function(arg0, arg1) {
5774
+ __wbg_set_fillStyle_88f4ccfb74d7de05: function(arg0, arg1) {
5764
5775
  arg0.fillStyle = arg1;
5765
5776
  },
5766
- __wbg_set_fillStyle_76ebff6831ea9a88: function(arg0, arg1) {
5777
+ __wbg_set_fillStyle_a6dc6303c382ed50: function(arg0, arg1) {
5767
5778
  arg0.fillStyle = arg1;
5768
5779
  },
5769
- __wbg_set_font_1cb7225ed52d9f14: function(arg0, arg1, arg2) {
5780
+ __wbg_set_fillStyle_e51447e54357dc46: function(arg0, arg1, arg2) {
5781
+ arg0.fillStyle = getStringFromWasm0(arg1, arg2);
5782
+ },
5783
+ __wbg_set_font_295aa505e45244aa: function(arg0, arg1, arg2) {
5770
5784
  arg0.font = getStringFromWasm0(arg1, arg2);
5771
5785
  },
5772
- __wbg_set_globalAlpha_5aec89813a61973c: function(arg0, arg1) {
5786
+ __wbg_set_globalAlpha_1660b0603161d11b: function(arg0, arg1) {
5773
5787
  arg0.globalAlpha = arg1;
5774
5788
  },
5775
- __wbg_set_height_26ab95ff99e2b620: function(arg0, arg1) {
5789
+ __wbg_set_height_be9b2b920bd68401: function(arg0, arg1) {
5776
5790
  arg0.height = arg1 >>> 0;
5777
5791
  },
5778
- __wbg_set_lineCap_b6e1677f577e962e: function(arg0, arg1, arg2) {
5792
+ __wbg_set_lineCap_63624e83cb57fb8b: function(arg0, arg1, arg2) {
5779
5793
  arg0.lineCap = getStringFromWasm0(arg1, arg2);
5780
5794
  },
5781
- __wbg_set_lineWidth_b403909aac47bdf0: function(arg0, arg1) {
5795
+ __wbg_set_lineWidth_2fae105117e1a89f: function(arg0, arg1) {
5782
5796
  arg0.lineWidth = arg1;
5783
5797
  },
5784
- __wbg_set_shadowBlur_803e1c05466b06c1: function(arg0, arg1) {
5798
+ __wbg_set_shadowBlur_f9653d1a9e1573ef: function(arg0, arg1) {
5785
5799
  arg0.shadowBlur = arg1;
5786
5800
  },
5787
- __wbg_set_shadowColor_74c62aada87854db: function(arg0, arg1, arg2) {
5801
+ __wbg_set_shadowColor_5882e8ce2ded629b: function(arg0, arg1, arg2) {
5788
5802
  arg0.shadowColor = getStringFromWasm0(arg1, arg2);
5789
5803
  },
5790
- __wbg_set_shadowOffsetX_513152482ef2ab1b: function(arg0, arg1) {
5804
+ __wbg_set_shadowOffsetX_1392477384fa4640: function(arg0, arg1) {
5791
5805
  arg0.shadowOffsetX = arg1;
5792
5806
  },
5793
- __wbg_set_shadowOffsetY_1aa4ef4e5d2e7823: function(arg0, arg1) {
5807
+ __wbg_set_shadowOffsetY_34fbe4164fc72313: function(arg0, arg1) {
5794
5808
  arg0.shadowOffsetY = arg1;
5795
5809
  },
5796
- __wbg_set_src_5d34b11a5c99434b: function(arg0, arg1, arg2) {
5810
+ __wbg_set_src_59f1be1c833b4918: function(arg0, arg1, arg2) {
5797
5811
  arg0.src = getStringFromWasm0(arg1, arg2);
5798
5812
  },
5799
- __wbg_set_strokeStyle_86e8cc93fb4bd2db: function(arg0, arg1, arg2) {
5813
+ __wbg_set_strokeStyle_0429d48dae657e53: function(arg0, arg1, arg2) {
5800
5814
  arg0.strokeStyle = getStringFromWasm0(arg1, arg2);
5801
5815
  },
5802
- __wbg_set_textAlign_e124c6a98f20f112: function(arg0, arg1, arg2) {
5816
+ __wbg_set_textAlign_e1a83482b00339b8: function(arg0, arg1, arg2) {
5803
5817
  arg0.textAlign = getStringFromWasm0(arg1, arg2);
5804
5818
  },
5805
- __wbg_set_textBaseline_3680ec3c0053a436: function(arg0, arg1, arg2) {
5819
+ __wbg_set_textBaseline_8662e97190d0164a: function(arg0, arg1, arg2) {
5806
5820
  arg0.textBaseline = getStringFromWasm0(arg1, arg2);
5807
5821
  },
5808
- __wbg_set_width_81fa781e87b17891: function(arg0, arg1) {
5822
+ __wbg_set_width_5cda41d4d06a14dd: function(arg0, arg1) {
5809
5823
  arg0.width = arg1 >>> 0;
5810
5824
  },
5811
5825
  __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
@@ -5815,35 +5829,35 @@ function __wbg_get_imports() {
5815
5829
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
5816
5830
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
5817
5831
  },
5818
- __wbg_static_accessor_GLOBAL_THIS_a1248013d790bf5f: function() {
5819
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
5832
+ __wbg_static_accessor_GLOBAL_8cfadc87a297ca02: function() {
5833
+ const ret = typeof global === 'undefined' ? null : global;
5820
5834
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
5821
5835
  },
5822
- __wbg_static_accessor_GLOBAL_f2e0f995a21329ff: function() {
5823
- const ret = typeof global === 'undefined' ? null : global;
5836
+ __wbg_static_accessor_GLOBAL_THIS_602256ae5c8f42cf: function() {
5837
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
5824
5838
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
5825
5839
  },
5826
- __wbg_static_accessor_SELF_24f78b6d23f286ea: function() {
5840
+ __wbg_static_accessor_SELF_e445c1c7484aecc3: function() {
5827
5841
  const ret = typeof self === 'undefined' ? null : self;
5828
5842
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
5829
5843
  },
5830
- __wbg_static_accessor_WINDOW_59fd959c540fe405: function() {
5844
+ __wbg_static_accessor_WINDOW_f20e8576ef1e0f17: function() {
5831
5845
  const ret = typeof window === 'undefined' ? null : window;
5832
5846
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
5833
5847
  },
5834
- __wbg_strokeRect_de27ebfce0d53872: function(arg0, arg1, arg2, arg3, arg4) {
5848
+ __wbg_strokeRect_502699d92aeb85f1: function(arg0, arg1, arg2, arg3, arg4) {
5835
5849
  arg0.strokeRect(arg1, arg2, arg3, arg4);
5836
5850
  },
5837
- __wbg_strokeText_20598a08b7e2a7b1: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
5851
+ __wbg_strokeText_fd5393a1c9f02f23: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
5838
5852
  arg0.strokeText(getStringFromWasm0(arg1, arg2), arg3, arg4);
5839
5853
  }, arguments); },
5840
- __wbg_stroke_ec05fb6fc31115a7: function(arg0) {
5854
+ __wbg_stroke_42f07013960cf81b: function(arg0) {
5841
5855
  arg0.stroke();
5842
5856
  },
5843
- __wbg_translate_64d7e09091d88205: function() { return handleError(function (arg0, arg1, arg2) {
5857
+ __wbg_translate_34989493d69eaecd: function() { return handleError(function (arg0, arg1, arg2) {
5844
5858
  arg0.translate(arg1, arg2);
5845
5859
  }, arguments); },
5846
- __wbg_width_80cea93fc7f63070: function(arg0) {
5860
+ __wbg_width_5adcb07d04d08bdf: function(arg0) {
5847
5861
  const ret = arg0.width;
5848
5862
  return ret;
5849
5863
  },
package/rhwp_bg.wasm CHANGED
Binary file
package/rhwp_bg.wasm.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const version: () => [number, number];
5
+ export const init_panic_hook: () => void;
4
6
  export const __wbg_hwpdocument_free: (a: number, b: number) => void;
5
7
  export const __wbg_hwpviewer_free: (a: number, b: number) => void;
8
+ export const extractThumbnail: (a: number, b: number) => any;
6
9
  export const hwpdocument_addBookmark: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number, number];
7
10
  export const hwpdocument_applyCellStyle: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
8
11
  export const hwpdocument_applyCharFormat: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
@@ -241,8 +244,6 @@ export const hwpviewer_setZoom: (a: number, b: number) => void;
241
244
  export const hwpviewer_updateViewport: (a: number, b: number, c: number, d: number, e: number) => void;
242
245
  export const hwpviewer_visiblePages: (a: number) => [number, number];
243
246
  export const hwpviewer_pageCount: (a: number) => number;
244
- export const version: () => [number, number];
245
- export const init_panic_hook: () => void;
246
247
  export const __wbindgen_exn_store: (a: number) => void;
247
248
  export const __externref_table_alloc: () => number;
248
249
  export const __wbindgen_externrefs: WebAssembly.Table;