您好,经调研,您的模板中存在以下三种情况的中文字体:
需要为这三种情况都注册字体才可以在导出时不显示乱码。
- function registerServerFont(name, type, serverPath) {
- let xhr = new XMLHttpRequest();
- xhr.open("GET", serverPath, true);
- xhr.responseType = "blob";
- xhr.onload = function (e) {
- if (this.status == 200) {
- let blob = this.response;
- console.log("blob", blob);
- let reader = new FileReader();
- reader.onload = function (e) {
- let fontArrayBuffer = reader.result;
- let fonts = GC.Spread.Sheets.PDF.PDFFontsManager.getFont(name) || {};
- fonts[type] = fontArrayBuffer;
- GC.Spread.Sheets.PDF.PDFFontsManager.registerFont(name, fonts);
- };
- reader.readAsArrayBuffer(blob);
- }
- };
- xhr.send();
- }
复制代码
导出结果为:
|