@file-viewer/renderer-pdf 3.3.0 → 3.3.2

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.en.md CHANGED
@@ -67,6 +67,8 @@ When no explicit PDF asset URL is configured, the renderer first uses the public
67
67
 
68
68
  `identityFontRepair` is also enabled by default for malformed PDFs that write TrueType glyph IDs through `Identity-H`/`Identity-V` but omit `ToUnicode`. The repair module is loaded only after CJK font substitution and multiple control-character glyphs are detected. If the same PDF embeds a usable same-family TrueType font, its cmap is used to rebuild the Unicode mapping for the in-memory preview. The repair is applied only to a preview copy and never overwrites the original file or download source; an unsafe or unsupported repair falls back to the original preview. Set the option to `false` to disable this compatibility path.
69
69
 
70
+ Predefined CID CMaps such as `UniGB-UCS2-H/V`, GBK, and Big5 keep their multibyte decoding even when a font omits `FontDescriptor`. These documents use their declared CMap and any supplied `ToUnicode` mapping; they do not require the optional Identity-font repair capability. Original PDF bytes remain unchanged.
71
+
70
72
  ## Migration Note
71
73
 
72
74
  PDF rendering has moved out of `@file-viewer/core` into this package, and `pdfjs-dist` is now declared only by `@file-viewer/renderer-pdf`. Installing core or a standard component package no longer pulls PDF.js; explicitly assemble this renderer when PDF preview is needed, or use `@file-viewer/preset-all`.
package/README.md CHANGED
@@ -67,6 +67,8 @@ When no explicit PDF asset URL is configured, the renderer first uses the public
67
67
 
68
68
  `identityFontRepair` is also enabled by default for malformed PDFs that write TrueType glyph IDs through `Identity-H`/`Identity-V` but omit `ToUnicode`. The repair module is loaded only after CJK font substitution and multiple control-character glyphs are detected. If the same PDF embeds a usable same-family TrueType font, its cmap is used to rebuild the Unicode mapping for the in-memory preview. The repair is applied only to a preview copy and never overwrites the original file or download source; an unsafe or unsupported repair falls back to the original preview. Set the option to `false` to disable this compatibility path.
69
69
 
70
+ Predefined CID CMaps such as `UniGB-UCS2-H/V`, GBK, and Big5 keep their multibyte decoding even when a font omits `FontDescriptor`. These documents use their declared CMap and any supplied `ToUnicode` mapping; they do not require the optional Identity-font repair capability. Original PDF bytes remain unchanged.
71
+
70
72
  ## Migration Note
71
73
 
72
74
  PDF rendering has moved out of `@file-viewer/core` into this package, and `pdfjs-dist` is now declared only by `@file-viewer/renderer-pdf`. Installing core or a standard component package no longer pulls PDF.js; explicitly assemble this renderer when PDF preview is needed, or use `@file-viewer/preset-all`.
package/README.zh-CN.md CHANGED
@@ -62,6 +62,8 @@ const options = {
62
62
 
63
63
  `identityFontRepair` 也默认开启,用于少数把 TrueType 字形 ID 写入 `Identity-H`/`Identity-V`、却遗漏 `ToUnicode` 的异常 PDF。只有检测到中文字体替换和多个控制字符乱码时,渲染器才会懒加载修复模块;若文件内同时嵌入了可用的同族 TrueType 字体,就从其 cmap 重建内存预览所需的 Unicode 映射。修复只作用于预览副本,不覆盖原始文件和下载源;无法安全修复时继续使用原预览。可设为 `false` 关闭。
64
64
 
65
+ 字体遗漏 `FontDescriptor` 时,`UniGB-UCS2-H/V`、GBK、Big5 等预定义 CID CMap 仍按多字节编码解码,并保留文件提供的 `ToUnicode` 映射。这类 PDF 无需额外安装 Identity 字体修复能力,原始 PDF 字节也不会改写。
66
+
65
67
  ## 迁移说明
66
68
 
67
69
  直接启动真实 Worker,不再额外读取版本前缀或重复下载 Worker。
@@ -41419,7 +41419,9 @@ class PartialEvaluator {
41419
41419
  }) {
41420
41420
  const isType3Font = type === "Type3";
41421
41421
  if (!descriptor) {
41422
- if (isType3Font) {
41422
+ // File Viewer modification: preserve composite CMap decoding when a CID
41423
+ // font omits its descriptor; simple-font fallback splits multibyte codes.
41424
+ if (isType3Font || composite) {
41423
41425
  descriptor = Dict.empty;
41424
41426
  } else {
41425
41427
  let baseFontName = dict.get("BaseFont");
@@ -8,8 +8,8 @@
8
8
  "sourcePatches": [
9
9
  {
10
10
  "path": "patches/pdfjs-dist@5.4.624.patch",
11
- "sha256": "a484b7eff884a0e5161286126623b28a0d3100053f850a56f5ae56e587ab4c26",
12
- "size": 3623
11
+ "sha256": "dd0af2e8847d9ed2723574797564f505cf1a6a047bfd985a0697e48dd472ae97",
12
+ "size": 4074
13
13
  }
14
14
  ],
15
15
  "runtimeFiles": [
@@ -23,11 +23,11 @@
23
23
  },
24
24
  {
25
25
  "path": "legacy/build/pdf.worker.mjs",
26
- "sourceSize": 2139821,
27
- "sourceSha256": "6c97b16c12986a5043311d7c4a15043e6f160db2503795e9a6804b85e8054c1d",
26
+ "sourceSize": 2139994,
27
+ "sourceSha256": "074fbf16f667591c6c26293628c0bb1b1102e98e1d64f493217e1ad7565813c7",
28
28
  "runtimeBindingReplacements": 793,
29
- "size": 2144698,
30
- "sha256": "195cbedfa6bb5d7f4e6296c06fdf38b193a53de623127865677355ea164e1b03"
29
+ "size": 2144871,
30
+ "sha256": "8a7a14f316883c7d4740da0a0a3c6a9036575b0c77c567a33a0df9001262cceb"
31
31
  },
32
32
  {
33
33
  "path": "legacy/web/pdf_viewer.mjs",
@@ -3,15 +3,23 @@
3
3
  "schemaVersion": 1,
4
4
  "id": "pdf",
5
5
  "packageName": "@file-viewer/renderer-pdf",
6
- "rendererIds": ["pdf"],
7
- "formats": ["pdf"],
6
+ "rendererIds": [
7
+ "pdf"
8
+ ],
9
+ "formats": [
10
+ "pdf"
11
+ ],
8
12
  "assets": {
9
- "rendererIds": ["pdf"],
13
+ "rendererIds": [
14
+ "pdf"
15
+ ],
10
16
  "packageName": "@file-viewer/assets-standard",
11
17
  "bin": "file-viewer-assets-standard",
12
18
  "apiExport": "installFileViewerStandardAssets",
13
19
  "target": "public/file-viewer",
14
- "copyGroups": ["pdf"],
20
+ "copyGroups": [
21
+ "pdf"
22
+ ],
15
23
  "copyMode": "profile-pack",
16
24
  "receiptFilename": "file-viewer-assets-standard.receipt.json",
17
25
  "notice": "PDF.js Worker, CMaps, WASM, standard fonts, and CJK fallback fonts."
@@ -20,10 +28,20 @@
20
28
  "spdx": "Apache-2.0",
21
29
  "policy": "permissive",
22
30
  "notices": [
23
- { "packageName": "pdfjs-dist", "spdx": "Apache-2.0" },
24
- { "packageName": "@fontsource-variable/noto-sans-sc", "spdx": "OFL-1.1" }
31
+ {
32
+ "packageName": "pdfjs-dist",
33
+ "spdx": "Apache-2.0"
34
+ },
35
+ {
36
+ "packageName": "@fontsource-variable/noto-sans-sc",
37
+ "spdx": "OFL-1.1"
38
+ }
25
39
  ]
26
40
  },
27
41
  "weight": "standard",
28
- "profiles": ["standard", "office", "all"]
42
+ "profiles": [
43
+ "standard",
44
+ "office",
45
+ "all"
46
+ ]
29
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/renderer-pdf",
3
- "version": "3.3.0",
3
+ "version": "3.3.2",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Standalone PDF renderer plugin for File Viewer powered by PDF.js.",
@@ -296,8 +296,8 @@
296
296
  "README.zh-CN.md"
297
297
  ],
298
298
  "dependencies": {
299
- "@file-viewer/core": "3.3.0",
300
- "@fontsource-variable/noto-sans-sc": "5.3.0"
299
+ "@file-viewer/core": "3.3.1",
300
+ "@fontsource-variable/noto-sans-sc": "5.3.1"
301
301
  },
302
302
  "peerDependencies": {
303
303
  "pdf-lib": "1.17.1"