Conversation
This change replaces `pdf-lib` and `fontkit` with `@ralfstx/pdf-core` as the underlying PDF generation library. This results in faster PDF generation, smaller bundle size, and opens up new possibilities such as font shaping. Loading font and image data from base64-encoded strings was a feature of `pdf-lib`. Reading encoded data should better be done outside of the library, so we drop this feature and require `Uint8Array`. With `pdf-core`, we can directly use the OS/2 typographic metrics for font metrics instead of relying on the hhea table values. This is the correct approach but it results in tighter line spacing for fonts whose hhea values include extra spacing that was effectively double-counted with the `lineHeight` multiplier. Links and anchors are supported by `pdf-core`, so the custom rendering code is removed. Parsing JPEG and PNG data is also handled by `pdf-core`, so the related code is removed. Rendering functions are simplified to use the `ContentStream` API directly. The version is bumped to 0.6.0 to account for the breaking changes in the API. 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.
This change replaces
pdf-libandfontkitwith@ralfstx/pdf-coreas the underlying PDF generation library. This results in faster PDF generation, smaller bundle size, and opens up new possibilities such as font shaping.Loading font and image data from base64-encoded strings was a feature of
pdf-lib. Reading encoded data should better be done outside of the library, so we drop this feature and requireUint8Array.With
pdf-core, we can directly use the OS/2 typographic metrics for font metrics instead of relying on the hhea table values. This is the correct approach but it results in tighter line spacing for fonts whose hhea values include extra spacing that was effectively double-counted with thelineHeightmultiplier.Links and anchors are supported by
pdf-core, so the custom rendering code is removed. Parsing JPEG and PNG data is also handled bypdf-core, so the related code is removed. Rendering functions are simplified to use theContentStreamAPI directly.The version is bumped to 0.6.0 to account for the breaking changes in the API.