You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support embedded-only fonts - avoid loading defaults during initialization #1647
PDFKit currently requires filesystem access to load default fonts during document initialization, even when later using only embedded fonts via registerFont(). This breaks in environments where system font paths are unavailable, e.g. compiled portable Deno executable in my case.
Code sample
// Fails - tries to load system fonts during initializationconstdoc1=newPDFDocument();// Also fails - undefined still triggers default font loadingconstdoc2=newPDFDocument({font: undefined});
My current workaround is to initialize document with empty string to bypass default font loading, then register embedded fonts:
constdoc=newPDFDocument({font: ""});// Skip system font loadingdoc.registerFont('Courier',embeddedCourierData);doc.font('Courier');
Activity
monolithed commentedon Dec 5, 2025
Unfortunately, this workaround breaks something else. If no text is provided, almost any call ends up throwing an error.
In the example with
.moveDown, it will fail at: