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
I was running into the same errors as this issue and was particularly confused about this error:
Uncaught (in promise) TypeError: Cannot read property 'split' of undefined
at new AFMFont (pdfkit.es5.js:2453)
at new StandardFont (pdfkit.es5.js:2700)
at Function.open (pdfkit.es5.js:3096)
at PDFDocument.font (pdfkit.es5.js:3170)
at PDFDocument.initFonts (pdfkit.es5.js:3132)
at new PDFDocument (pdfkit.es5.js:4890)
at new PDFBuilder (PDFBuilder.js:42)
at PDFCreator.createID (index.jsx:40)
at PDFCreator.componentDidMount (index.jsx:72)
The proposed workaround was to do a direct import from raw-loader:
import Helvetica from '!!raw-loader!pdfkit/js/data/Helvetica.afm'
This was strange to me as removing the !!raw-loader! portion still seemed to work and furthermore adding !!raw-loader! to the require.context call did not fix the error.
Turns out you just needed to use the default export of the files to avoid the error:
I was running into the same errors as this issue and was particularly confused about this error:
The proposed workaround was to do a direct import from
raw-loader
:import Helvetica from '!!raw-loader!pdfkit/js/data/Helvetica.afm'
This was strange to me as removing the
!!raw-loader!
portion still seemed to work and furthermore adding!!raw-loader!
to therequire.context
call did not fix the error.Turns out you just needed to use the default export of the files to avoid the error:
Not sure if this was a pdfkit update or what but it'd be good to update that line.
"pdfkit": "^0.10.0"
"webpack": "^4.39.2"
"arraybuffer-loader": "^1.0.7"
"raw-loader": "^3.1.0"
"transform-loader": "^0.2.4"
The text was updated successfully, but these errors were encountered: