New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom font causes infinite pending of toBlob
#2743
Comments
I think you are seeing the same issue as #2706, try overriding |
yes... it seems the same issue. And the solution #2706 (comment) could resolve this. note: the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Using custom font will cause an infinite pending of the
toBlob
method.To Reproduce
I've reproduced this in both CRA and Vite project.
To reproduce it:
toBlob
method of the PDF instanceAn example:
P.S. once use the builtin
Helvetica
the blob could be properly generated.I've dived into the root cause, and it seems it's related to the
_fontFamily
property of thePDFDocument
Custom font seems not to be properly added to the
_fontFamily
, thus relatedPDFReference
will not be finalized on the document's ending. Inpackages/pdfkit/src/mixins/fonts.js:64-66
, the_font.name
isnull
for a custom font, so it would not be added to the_fontFamilies
and will not be finalized inpackages/pdfkit/src/document.js:262-265
.As for the
_font.name
, I found the initializing inpackages/pdfkit/src/font/embedded.js:21
, and thepostscriptName
seems to be initialized in the constructor ofFontSource
. While I tryed add apostscriptName
to the option of register, an error was thrown:Any idea on it? Please let know if this is a misusage.
Version Used
renderer
: 3.4.4fns
: 2.2.1font
: 2.5.1layout
: 3.12.1pdfkit
: 3.1.10primitives
: 3.1.1render
: 3.4.4stylesheet
: 4.2.5textkit
: 4.4.1types
: 2.5.0The text was updated successfully, but these errors were encountered: