Conversation
When no `info` object was provided to `renderDocument`, the `setMetadata` function was skipped entirely, resulting in PDFs without `CreationDate` or `ModDate` metadata. Remove the `if (info !== undefined)` guard so that dates are always set. Use optional chaining for all other info fields, which safely passes `undefined` when info is absent. Add a test to verify dates are present even without explicit info. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The deprecated `images` property in `DocumentDefinition` allowed to register images by name. This is no longer needed since images can be referred to by URL. This commit replaces the unnecessarily complex `ImageStore` class with a simpler `ImageLoader` that is created per `makePdf` call. Images with the same URL are loaded only once within a document. The `setResourceRoot` method is preserved for `file:/` URL support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The `Image` type was a wrapper around `PDFImage` with redundant `width` and `height` fields (already on `PDFImage`) and unused `url` and `format` fields that were set but never read. Remove `images.ts` entirely and use `PDFImage` directly in all places. Make `ImageFormat` a file-local type in `image-loader.ts`. Simplify `fakeImage` test helper to return `PDFImage` directly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
`FontStore` parsed each font twice: once in `registerFont()` to extract metadata, and again in `_loadFont()` when actually selecting a font. Additionally, a stale TODO comment remained from the pdf-core migration, and the deprecated `fonts` property in the document definition was still supported. Store the `PDFEmbeddedFont` created during `registerFont()` in `FontDef` so that `_loadFont()` can reuse it. Remove the `fonts` property from `DocumentDefinition`, along with `readFonts`, `readFont`, `FontsDefinition`, `FontDefinition`, and the `FontStore` constructor parameter. Update font-store tests to use `registerFont()` with explicit config instead of pre-built `FontDef` arrays. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The `Font` type was a thin wrapper around `PDFFont`, duplicating properties (`key`, `style`, `weight`) that already exist on the underlying `PDFFont` class. Consumers always dereferenced `.pdfFont` to access the actual font object. Remove the `Font` type and use `PDFFont` directly throughout the codebase. `FontStore.selectFont()` now returns `PDFFont` instead of `Font`, eliminating the wrapping logic in `_loadFont`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.