I'm using the PDFMake library and trying to use a custom font in its output. This font is made for the Persian language. I followed the steps described on the web page below custom-fonts-client-side/vfs
I encountered the following error when executing the node build-vfs.js "./examples/fonts"
command:
Internal/modules/cjs/loader.js:888
throw err;
^
Error: Cannot find module 'D:\ProgrammingWorld\Github_Library\Cyeng\NewProject\onGit\NewProject\build-vfs.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
So I decided to change the command and write it as follows:
node node_modules/pdfmake/build-vfs.js "node_modules\pdfmake\examples\fonts"
But unfortunately, I got a new error:
Source path: node_modules\pdfmake\examples\fonts
FILE: Shabnam-Bold.ttf
FILE: Shabnam-Light.ttf
FILE: Shabnam-Medium.ttf
FILE: Shabnam-Thin.ttf
FILE: Shabnam.ttf
internal/fs/utils.js:312
throw err;
^
Error: ENOENT: no such file or directory, open './build/vfs_fonts.js'
at Object.openSync (fs.js:498:3)
at Object.writeFileSync (fs.js:1524:35)
at Object.<anonymous> (D:\ProgrammingWorld\Github_Library\Cyeng\NewProject\onGit\NewProject\node_modules\pdfmake\build-vfs.js:41:4)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
errno: -4058,
syscall: 'open',
code: 'ENOENT',
path: './build/vfs_fonts.js'
}
Go to node_modules/pdfmake/
directory and run node build-vfs.js "./examples/fonts"