docs/module-fileloading.html
Source:
| Type | Description |
|---|---|
| Array.<string> | undefined |
Controls which local files may be read by jsPDF when running under Node.js.
Security recommendation:
node --permission --allow-fs-read=...) instead of this property, especially in production. The Node flags are enforced by the runtime and provide stronger guarantees.Behavior:
When present, jsPDF will allow reading only if the requested, resolved absolute path matches any entry in this array.
Each entry can be either:
* to allow all paths starting with that prefix.Examples of allowed patterns:
"./fonts/MyFont.ttf" (exact match by resolved path)"/abs/path/to/file.txt" (exact absolute path)"./assets/*" (any file whose resolved path starts with the resolved ./assets/ directory)Notes:
process.permission), it is checked first. If it denies access, reading will fail regardless of allowFsRead.process.permission nor allowFsRead is set, reading from the local file system is disabled and an error is thrown.Example:
const doc = jsPDF();
doc.allowFsRead = ["./fonts/*", "./images/logo.png"]; // allow everything under ./fonts and a single file
const ttf = doc.loadFile("./fonts/MyFont.ttf", true);
Source:
| Name | Type | Description |
|---|---|---|
url | string | |
sync | boolean | |
callback | function |
result
Type string | undefined
Source:
| Name | Type | Description |
|---|---|---|
path | string | |
sync | boolean | |
callback | function |