Open AdrianKochanski opened 1 month ago
I checked the template.json you attached.
In that file, we can see NotoSerifJP-Regular
in a fontName prop. NotoSerifJP-Regular doesn't contain Chinese characters.
So please set a Chinese Custom Fonts in a generator and UI packages.
Describe the bug
The template designer is displaying the chinese characters in the right way, but the generation pdf with the same data is not working.
To Reproduce
pdfme_template.json
Use the template above for generating the pdf with the data below: [["1","47545843","","收割机转子(滚筒)","01654","","HR015","","Yes","05/08/2022","Yes"],["1","47613135","","泵 辅助","0522013616","","HR043","","Yes","12/08/2022","No"],["1","47984257","","CAB W/HEATER AND AC","2201","","HR014","","Yes","15/08/2022","Yes"],["1","51443795","","轮胎总成, 28L-26 18PR R2","2DHB010301","","HR040","","Yes","15/08/2022","No"]]
Expected behavior
Exports works with UTF-8 characters
Your Environment
Your Error Log
Additional context
An error occurred.Uncaught (in promise): Error: WinAnsi cannot encode "收" (0x6536) Error: WinAnsi cannot encode "收" (0x6536) at Encoding.encodeUnicodeCodePoint (http://localhost:4200/node_modules_pdfme_schemas_dist_esm_src_index_js-_abcb0.js:32:15) at StandardFontEmbedder.encodeTextAsGlyphs (http://localhost:4200/node_modules_pdfme_schemas_dist_esm_src_index_js-_abcb0.js:38067:35) at StandardFontEmbedder.encodeText (http://localhost:4200/node_modules_pdfme_schemas_dist_esm_src_index_js-_abcb0.js:38000:25) at PDFFont.encodeText (http://localhost:4200/node_modules_pdfme_schemas_dist_esm_src_index_js-_abcb0.js:24527:26) at PDFPage.drawText (http://localhost:4200/node_modules_pdfme_schemas_dist_esm_src_index_js-_abcb0.js:25721:35) at http://localhost:4200/node_modules_pdfme_schemas_dist_esm_src_index_js-_abcb0.js:6315:12 at Array.forEach ()
at http://localhost:4200/node_modules_pdfme_schemas_dist_esm_src_index_js-_abcb0.js:6295:11
at Generator.next ()
at asyncGeneratorStep (http://localhost:4200/vendor.js:7485:24)
ERROR Error: Uncaught (in promise): Error: WinAnsi cannot encode "收" (0x6536) Error: WinAnsi cannot encode "收" (0x6536) at Encoding.encodeUnicodeCodePoint (Encoding.js:18:23) at StandardFontEmbedder.encodeTextAsGlyphs (StandardFontEmbedder.js:84:41) at StandardFontEmbedder.encodeText (StandardFontEmbedder.js:25:29) at PDFFont.encodeText (PDFFont.js:34:30) at PDFPage.drawText (PDFPage.js:851:41) at pdfRender.js:101:14 at Array.forEach ()
at pdfRender.js:83:11
at Generator.next ()
at asyncGeneratorStep (asyncToGenerator.js:3:1)
at resolvePromise (zone.js:1211:31)
at zone.js:1118:17
at zone.js:1134:33
at asyncGeneratorStep (asyncToGenerator.js:6:1)
at _throw (asyncToGenerator.js:25:1)
at _ZoneDelegate.invoke (zone.js:372:26)
at Object.onInvoke (core.mjs:25620:33)
at _ZoneDelegate.invoke (zone.js:371:52)
at Zone.run (zone.js:134:43)
at zone.js:1275:36