@imgly/pdf-importer 0.1.0 → 0.2.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.
- package/CHANGELOG.md +31 -0
- package/LICENSE.md +137 -650
- package/dist/browser.d.cts +117 -10317
- package/dist/browser.d.ts +117 -10317
- package/dist/browser.js +14 -13
- package/dist/node.cjs +13 -12
- package/dist/node.d.cts +117 -10317
- package/dist/node.d.ts +117 -10317
- package/dist/node.js +13 -12
- package/package.json +10 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @imgly/pdf-importer
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
### Fidelity fixes
|
|
6
|
+
|
|
7
|
+
- Fixed later fragments of a colored text run being imported as default black. A producer can draw one styled run (e.g. white "FOR DUTY") that pdf.js splits into several kerned text items; the walker records one color snapshot per `showText`, so an earlier fragment consumed the run's only snapshot and a later fragment fell through to a `null` fill (painted as default RGB black). A later fragment now inherits the fill from a consumed same-line sibling when the donors are fill-painting (render modes 0/2/4/6), sit within a width-scaled horizontal window, and unanimously agree on one color; it falls back to the safe `null` path otherwise.
|
|
8
|
+
|
|
9
|
+
## 0.2.0
|
|
10
|
+
|
|
11
|
+
### Text
|
|
12
|
+
|
|
13
|
+
- Merge adjacent text runs from the same logical font family that differ only by weight, style, or color into a single editable text block with per-character style spans. Inline emphasis in headlines (e.g. regular + bold + italic words sharing a baseline) now imports as one paragraph block instead of several, with `getTextFontWeights` / `getTextFontStyles` reporting the mixed styles. The merger bridges the word-space gap between font subsets and re-applies style spans through the text-fit pass. Color-only merging (the previous behavior) is preserved. (#15583)
|
|
14
|
+
|
|
15
|
+
### Page-level block emission (used by `@imgly/idml-importer`)
|
|
16
|
+
|
|
17
|
+
- Added `PDFParser.loadAsBlocks({ pageIndex })` — emits one PDF page as a detached, grouped CE.SDK block (mirrors `engine.block.loadFromString` semantics). Returns `{ blocks, logger }` so callers can forward parser warnings into their own diagnostic stream. Used by `@imgly/idml-importer` to import `<PDF>` embeds; available to other consumers that need page-level emission without creating a top-level scene. (#15265)
|
|
18
|
+
- Added `PDFParser.getPageCount()` so callers can size loops over `loadAsBlocks` without parsing twice. The first call extracts the IR; `parse()` and `loadAsBlocks()` reuse the same cached IR. (#15265)
|
|
19
|
+
- The wrapper group returned from `loadAsBlocks` is anchored to the PDF `MediaBox` via an invisible spacer rect, so the group's bbox always matches the page size even when content fills only a subset. (#15265)
|
|
20
|
+
- New warning code `PAGE_INDEX_OUT_OF_RANGE` emitted when `loadAsBlocks` is called with a `pageIndex` outside the document's range. (#15265)
|
|
21
|
+
- **BREAKING**: Dropped the top-level `Logger` named export from the package entry. The class is still reachable structurally via `PDFParser.parse().logger` / `loadAsBlocks(...).logger`; the explicit re-export collided with dts-bundle-generator's auto-emitted referenced-types export, producing a duplicate `export { Logger }` in the bundled `.d.ts`. Consumers that need to type the logger instance can use `Awaited<ReturnType<PDFParser['parse']>>['logger']`. (#15265)
|
|
22
|
+
|
|
23
|
+
### Fidelity fixes
|
|
24
|
+
|
|
25
|
+
- Preserve PDF dash patterns and line caps on stroked vector paths — dotted/dashed rules previously flattened to solid lines. The dotted-line idiom (a zero-length dash with a round cap) now renders as dots. The dash/cap APIs are feature-detected, so the peer-dependency floor stays at `>=1.70`; on engines older than 1.76 the stroke renders solid instead. (#15874)
|
|
26
|
+
- Tilted-image placement keeps its true visible width — a sub-degree tilt no longer inflates the axis-aligned bounding box and crops the image fill. (#15874)
|
|
27
|
+
- Image placements emit their true sub-3° rotation instead of snapping to upright, fixing large off-centre clipped images that imported visibly displaced. (#15874)
|
|
28
|
+
- `filterBackgroundArtifacts` no longer drops white shapes that merely sit inscribed in the page bounding box (e.g. a diamond filling the page); it now verifies the SVG path vertices sit at the bbox's four corners before treating a shape as a paper backdrop. (#15265)
|
|
29
|
+
|
|
30
|
+
### Requirements
|
|
31
|
+
|
|
32
|
+
- Node.js ≥ 22 is now required (previously ≥ 20).
|
|
33
|
+
|
|
3
34
|
## 0.1.0
|
|
4
35
|
|
|
5
36
|
First public release of `@imgly/pdf-importer` — convert PDF files into
|