Repository navigation
Conversation
A URL font that doesn't download within 10 seconds, isn't a TTF, OTF or WOFF file, is cut short, or is WOFF2 (which pdfmake prints blank) falls back to Helvetica, and isn't cached. A missing bold or italics style uses the closest file the font has. loadFont also returns each style's ascender and capital height, and createDocument passes them to the template as fontMetrics. loadImage loads an image within 10 seconds: PNG and JPEG as they are, SVG as vector, other formats drawn to PNG. It returns null when the image can't be loaded.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
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.
ref: https://app.clickup.com/t/86bbf0d90
Moves the font and image loading that the my-orders receipt does on its own into the toolkit, so every PDF widget gets it.
Fonts
loadFont(pdfMake, font)returns{ family, fontMetrics }.createDocumentpassesfontMetricsto the template: each style's ascender and capital height per em, or null when they can't be read, for lining shapes up with text.Images
loadImage(src, { maxWidth, maxHeight })returns a node to spread into the document:{ image }for PNG and JPEG,{ svg }for an SVG file, and a canvas-drawn PNG for other formats. It gives up after 10 seconds and returns null when the image can't be loaded.resolveFontandimageDataUrlkeep their signatures.Same change as #392 for the 5.x line.