alafr / SVG-to-PDFKit

Insert SVG into a PDF document created with PDFKit
MIT License
398 stars 112 forks source link

Unable to load fonts from web URL within fontCallback due to promise delay #119

Closed kliemohn closed 4 years ago

kliemohn commented 4 years ago

I have seen samples of how to use fontCallback:

However, for my implementation I need to load the fonts from a web resource. As such I am using fetch() which returns a promise. In doing so, the svg-to-pdfkit complains because I haven't registered the font before exiting the fontCallback function. Is there a way to return a promise from the fontCallback function instead?

alafr commented 4 years ago

No, this is not possible with the current implementation. You can use the workaround described here.

Duplicate of #100

kliemohn commented 4 years ago

Thanks for the quick response and sorry for the duplicate!