以下是 pdfkit 和 pdf-make 的错误日志。
Error:
ERROR (com/11237): Cannot read properties of null (reading 'xCoordinate')
err: {
"type": "TypeError",
"message": "Cannot read properties of null (reading 'xCoordinate')",
"stack":
TypeError: Cannot read properties of null (reading 'xCoordinate')
at $1ab772dcf2da50dd$export$2e2bcd8739ae039.getAnchor (/node_modules/fontkit/dist/src/opentype/GPOSProcessor.js:289:20)
at $1ab772dcf2da50dd$export$2e2bcd8739ae039.applyAnchor (/node_modules/fontkit/dist/src/opentype/GPOSProcessor.js:276:27)
at $1ab772dcf2da50dd$export$2e2bcd8739ae039.applyLookup (/node_modules/fontkit/dist/src/opentype/GPOSProcessor.js:179:14)
at $1ab772dcf2da50dd$export$2e2bcd8739ae039.applyLookups (/node_modules/fontkit/dist/src/opentype/OTProcessor.js:203:26)
at $1ab772dcf2da50dd$export$2e2bcd8739ae039.applyFeatures (/node_modules/fontkit/dist/src/opentype/OTProcessor.js:184:10)
at $1ab772dcf2da50dd$export$2e2bcd8739ae039.applyFeatures (/node_modules/fontkit/dist/src/opentype/GPOSProcessor.js:309:11)
at $6703eaa61400de19$export$2e2bcd8739ae039.process (/node_modules/fontkit/dist/src/opentype/ShapingPlan.js:114:19)
at $2ec9b66dcab54746$export$2e2bcd8739ae039.position (/node_modules/fontkit/dist/src/opentype/OTLayoutEngine.js:67:17)
at $8fe7395fdc229fa3$export$2e2bcd8739ae039.position (/node_modules/fontkit/dist/src/layout/LayoutEngine.js:98:32)
at $8fe7395fdc229fa3$export$2e2bcd8739ae039.layout (/node_modules/fontkit/dist/src/layout/LayoutEngine.js:72:10)
"status": 500
}
我正在使用 pdfkit 制作 pdf,除了使用“一些”乌尔都语文本外,一切正常。有人对这个问题有想法吗?
const PDFDocument = require('pdfkit');
const fs = require('fs');
const doc = new PDFDocument();
doc.text("Hello World");
doc
.font('assets/Fonts/urdu/NotoNastaliqUrdu.ttf')
.fontSize(25)
.text('وزن', 100);
let out = fs.createWriteStream('output.pdf')
response.stream(doc)
doc.end()
out.on('finish', function () {
// what you want to do with the file.
});