Repository navigation
Conversation
0.20 no longer exposes js/pdfkit.standalone and its browser build ships no standard-font metrics until they are registered, while the PDFDocument constructor already sets Helvetica. Load the package entry and register the four faces the floor-plan export falls back to.
3 of 4 tasks
Contributor
Author
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.
What does this PR do?
Upgrades
pdfkitfrom ^0.19.1 to ^0.20.2 inpackages/editorand adapts the floor-plan PDF export to it. Major upgrade (0.x minor), so no auto-merge.Breaking changes (v0.20.0, v0.20.1, v0.20.2)
exportsmap, so deep imports such aspdfkit/js/pdfkit.standaloneno longer resolve. The browser entry is thedefaultcondition ofpdfkit.pdfkit/standard-fonts/*and registered withregisterStdFonts(). Node still loads them lazily.pdfkit/virtual-fs) is removed in favour ofregisterFile(path, Uint8Array).Bufferis no longer used internally.PDFDocument,LineWrapper,registerFile). AcroForm options are restricted to the documented mappings, annotation option keys are no longer uppercased automatically, andaddNamedEmbeddedFilethrows when no ref is given.toBytes/toBlobhelpers are available inpdfkit/output.Code changes
createFloorplanPdfDocumentimportspdfkitinstead ofpdfkit/js/pdfkit.standalone, and registers the four standard faces the export falls back to (Helvetica, Helvetica-Bold, Courier, Courier-Bold). This is required: thePDFDocumentconstructor sets Helvetica, so the browser build throwsStandard font "Helvetica" is not registeredonnew PDFDocument()without it. The Node build has noregisterStdFontsand loads its own metrics, so the call is optional-chained.pdfkit-standard-fonts.d.ts, because 0.20 ships thestandard-fonts/*entry points untyped and@types/pdfkit0.17.6 (the latest) predates them.How to test
bun install && bun run cibun dev, export a floor plan to PDF, then block thepdf-fonts/*.ttfrequests and export again. The second export exercises the standard-font fallback.Screenshots / screen recording
Not added yet.
Checklist
bun devbun checkto verify)mainbranchLocal results:
check,skills:validate,check-typesandbuildpass, with only the local-only test failures thatmainalso has. A script against pdfkit 0.20's browser build confirmed two things: an unregisterednew PDFDocument()throws, and after registering the four faces it renders all of them to a valid PDF. The full browser export flow has not been clicked through.