pdfium-native 0.3.0 → 0.3.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.
Files changed (2) hide show
  1. package/CHANGELOG.md +193 -0
  2. package/package.json +5 -2
package/CHANGELOG.md ADDED
@@ -0,0 +1,193 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
6
+
7
+ ## [0.3.0] - 2026-03-31
8
+
9
+ ### Added
10
+
11
+ - `ImagePageObject.render()` — extract and render embedded PDF images as PNG, JPEG, or raw stream bytes
12
+ - Three render modes: intrinsic bitmap, rendered bitmap (with mask/matrix), and raw encoded stream
13
+ - File output support for image rendering via `output` option
14
+ - `objects()` async generator on `PDFiumPage` for iterating all page objects
15
+ - Image dimension cap (`MAX_IMAGE_PIXELS = 256 MP`) to prevent allocation failures on huge embedded images
16
+ - Negative object index guard in `RenderImageWorker`
17
+
18
+ ### Changed
19
+
20
+ - **Breaking:** Default render format changed from JPEG to PNG for both `page.render()` and `image.render()` — use `{ format: 'jpeg' }` to restore previous behavior
21
+ - Image `render()` binding moved from TypeScript layer to native C++ (`GetObjectWorker::OnOK`) for cleaner API
22
+ - `PDFiumPage.getObject()` is now a direct passthrough to the native addon
23
+
24
+ ## [0.3.0] - 2026-03-31
25
+
26
+ ### Added
27
+
28
+ - `ImagePageObject.render()` — extract and render embedded PDF images as PNG, JPEG, or raw stream bytes
29
+ - Three render modes: intrinsic bitmap, rendered bitmap (with mask/matrix), and raw encoded stream
30
+ - File output support for image rendering via `output` option
31
+ - `objects()` async generator on `PDFiumPage` for iterating all page objects
32
+ - Image dimension cap (`MAX_IMAGE_PIXELS = 256 MP`) to prevent allocation failures on huge embedded images
33
+ - Negative object index guard in `RenderImageWorker`
34
+
35
+ ### Changed
36
+
37
+ - **Breaking:** Default render format changed from JPEG to PNG for both `page.render()` and `image.render()` — use `{ format: 'jpeg' }` to restore previous behavior
38
+ - Image `render()` binding moved from TypeScript layer to native C++ (`GetObjectWorker::OnOK`) for cleaner API
39
+ - `PDFiumPage.getObject()` is now a direct passthrough to the native addon
40
+
41
+ ## [0.2.4] - 2026-03-30
42
+
43
+ ### Fixed
44
+
45
+ - Bumped minimum Node.js version to 20.11.0 (`import.meta.dirname` requirement)
46
+ - Wrapped web `ReadableStream` with `Readable.fromWeb()` in install script
47
+ - Updated README Node version range from 18–24 to 20–24
48
+ - Used static import for `Readable` instead of dynamic `import()`
49
+
50
+ ### Added
51
+
52
+ - npm publish provenance (`--provenance` flag)
53
+ - Build provenance attestation for prebuilt binaries via `actions/attest-build-provenance`
54
+
55
+ ## [0.2.3] - 2026-03-28
56
+
57
+ ### Added
58
+
59
+ - `getFormFields()` for reading PDF form fields (text fields, checkboxes, radio buttons, combo boxes, list boxes, signatures)
60
+ - Bookmark sibling count limit (`MAX_SIBLINGS_PER_LEVEL = 10000`) to prevent DoS from malicious PDFs
61
+
62
+ ### Changed
63
+
64
+ - Extracted shared UTF-16 read/write helpers (`ReadU16`, `SetU16`, `SetU16IfPresent`, `ToNapiString`, `ActionTypeString`) to `napi_helpers.h`, reducing boilerplate across all workers
65
+ - Split monolithic `page_workers.h` (1500 lines) into 7 individual worker files
66
+ - Moved `CHECK_ALIVE` macro to `napi_helpers.h`
67
+
68
+ ### Fixed
69
+
70
+ - `ReadU16` now rejects odd byte lengths to prevent buffer overflow on malformed PDFs
71
+ - `SearchWorker` and `GetFormFieldsWorker` now properly reject (instead of silently resolving empty) when PDFium fails to load text page or initialize form environment
72
+ - Form fill environment cleanup is now guarded against null handle
73
+ - Render worker validates bitmap buffer and stride before pixel conversion
74
+ - Render worker pixel buffer allocation casts both dimensions to `size_t` to prevent integer overflow
75
+ - `stb_write_callback` guards against negative size parameter
76
+ - `LoadDocumentWorker` rejects buffers larger than `INT_MAX`
77
+ - Annotation handles are now closed before `push_back` to prevent resource leaks on allocation failure
78
+ - Text and search workers guard against `INT_MAX` overflow in buffer sizing
79
+ - Removed unused `#include <algorithm>` from `page.h`
80
+
81
+ ## [0.2.2] - 2026-03-28
82
+
83
+ ### Changed
84
+
85
+ - README overhaul: benefit-driven headline, Quick Start moved above features, grouped "Why" section (Performance / Developer experience / Reliability), use cases section, competitor comparison table with actual packages (@hyzyla/pdfium, pdfjs-dist, pdf-parse, pdf2json)
86
+ - Added npm badges (version, node, license, platform)
87
+ - Expanded npm keywords for discoverability
88
+ - Added homepage and bugs URLs to package.json
89
+
90
+ ## [0.2.1] - 2026-03-28
91
+
92
+ ### Changed
93
+
94
+ - Cross-compile `darwin-x64` on `macos-latest` (arm64) and `win32-arm64` on `windows-latest` (x64), eliminating dedicated runners
95
+ - Moved `linux-arm64` prebuild from native `ubuntu-24.04-arm` runner to QEMU Docker cross-compile
96
+ - Added `linux-musl-x64` and `linux-musl-arm64` prebuilds via Alpine Docker
97
+
98
+ ### Fixed
99
+
100
+ - `install.mjs` now detects musl libc and downloads the correct prebuilt tarball on Alpine/musl systems
101
+ - Cache page dimensions in C++ to avoid reading them without mutex in `Render()`
102
+ - `g_initialized` is now `std::atomic<bool>` for thread safety
103
+ - Consistent alive flag ordering in `PDFiumPage::CleanUp()` (set under mutex, matching `PDFiumDocument`)
104
+
105
+ ### Performance
106
+
107
+ - Binary size reduced ~37% via LTO, `-Os`, `-fvisibility=hidden`, dead code stripping, and link-time symbol stripping
108
+
109
+ ## [0.2.0] - 2026-03-28
110
+
111
+ ### Changed
112
+
113
+ - **BREAKING**: `getText()`, `getObject()`, `getLinks()`, `search()`, `getAnnotations()`, and `getBookmarks()` now return Promises instead of synchronous values
114
+ - `objects()` generator is now an async generator (`AsyncGenerator<PageObject>`)
115
+ - GetPage bounds check moved off the main thread into the async worker
116
+ - Alive flags in `destroy()`/`close()` are now set under the global mutex
117
+
118
+ ### Added
119
+
120
+ - GC Finalize callbacks on `PDFiumPage` and `PDFiumDocument` as safety net for unreleased resources
121
+ - `FPDF_DestroyLibrary` cleanup hook on environment teardown
122
+ - `page_workers.h` with dedicated AsyncWorker classes for all page/document operations
123
+
124
+ ### Fixed
125
+
126
+ - SSRF vulnerability in install script (CodeQL critical)
127
+ - Missing `permissions: contents: read` in CI/release workflow jobs (CodeQL medium)
128
+
129
+ ### Removed
130
+
131
+ - `ia32` platform support (macOS, Linux musl, Windows)
132
+
133
+ ## [0.1.7] - 2026-03-28
134
+
135
+ ### Fixed
136
+
137
+ - MSVC ARM64 build: compile `stb_image_write` as C++ to fix const initializer error
138
+
139
+ ## [0.1.6] - 2026-03-28
140
+
141
+ ### Fixed
142
+
143
+ - Windows prebuild: use bash shell for tarball creation
144
+
145
+ ## [0.1.5] - 2026-03-28
146
+
147
+ ### Changed
148
+
149
+ - Merged publish and prebuild into single `release.yml` workflow
150
+
151
+ ## [0.1.4] - 2026-03-28
152
+
153
+ ### Changed
154
+
155
+ - Release triggered by tag push (`v*`) instead of GitHub release event
156
+ - Auto-create GitHub release with prebuilt tarballs
157
+
158
+ ## [0.1.3] - 2026-03-28
159
+
160
+ ### Fixed
161
+
162
+ - npm publish authentication with OIDC trusted publishing (Node 24 / npm 11.5.1+)
163
+
164
+ ## [0.1.2] - 2026-03-28
165
+
166
+ ### Fixed
167
+
168
+ - Prebuild tarball naming and `contents: write` permission for release uploads
169
+
170
+ ## [0.1.1] - 2026-03-28
171
+
172
+ ### Fixed
173
+
174
+ - Prebuild workflow failures
175
+ - Added `@types/node` dev dependency
176
+
177
+ ## [0.1.0] - 2026-03-27
178
+
179
+ ### Added
180
+
181
+ - Async document loading from `Buffer` or file path (with optional password)
182
+ - Page rendering to JPEG/PNG (`Buffer` or file output) with scale/quality options
183
+ - Text extraction via `getText()`
184
+ - Text search with bounding rectangles via `search()`
185
+ - Page object inspection with discriminated union types (text/image/path/etc.)
186
+ - Document metadata as a cached readonly property
187
+ - Bookmark tree traversal via `getBookmarks()`
188
+ - Link enumeration via `getLinks()`
189
+ - Annotation reading via `getAnnotations()`
190
+ - Support for macOS (arm64, x64), Linux glibc (x64, arm64, arm, ia32, ppc64), Linux musl (x64, arm64, ia32), and Windows (x64, arm64, ia32)
191
+ - ESLint + Prettier configuration
192
+ - GitHub Actions publish workflow with test gate
193
+ - TypeScript type declarations for JS consumers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pdfium-native",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Native Node.js bindings for PDFium",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,7 +39,10 @@
39
39
  "src",
40
40
  "lib",
41
41
  "scripts",
42
- "binding.gyp"
42
+ "binding.gyp",
43
+ "README.md",
44
+ "CHANGELOG.md",
45
+ "LICENSE"
43
46
  ],
44
47
  "repository": {
45
48
  "type": "git",