|
@@ -274,26 +274,7 @@ let JpcJsPDFHelper = {
|
|
|
for (let val of orgValues) {
|
|
|
let actW = doc.getTextWidth(val);
|
|
|
if (actW > validAreaTxtWidth) {
|
|
|
- let lastIdx = 0;
|
|
|
- let hasEnd = false;
|
|
|
- while (!hasEnd) {
|
|
|
- let sCnt = 0;
|
|
|
- while (sCnt < val.length) {
|
|
|
- let cnt = 1;
|
|
|
- //支持HTML5的浏览器全是unicode数据,无需特别处理
|
|
|
- if (doc.getTextWidth(val.substring(lastIdx, sCnt + cnt)) > validAreaTxtWidth) {
|
|
|
- vals.push(val.substring(lastIdx, sCnt));
|
|
|
- lastIdx = sCnt;
|
|
|
- sCnt += cnt;
|
|
|
- } else {
|
|
|
- sCnt += cnt;
|
|
|
- }
|
|
|
- if (sCnt >= val.length) {
|
|
|
- hasEnd = true;
|
|
|
- vals.push(val.substring(lastIdx, val.length));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ vals = vals.concat(private_splitString(val, validAreaTxtWidth, doc));
|
|
|
} else {
|
|
|
vals.push(val);
|
|
|
}
|
|
@@ -369,6 +350,7 @@ let JpcJsPDFHelper = {
|
|
|
if (values[i][j] === ' ') spaceIdxArr.push(j);
|
|
|
}
|
|
|
}
|
|
|
+ // 但有了_splitValues()处理后,这个加额外空格好像没必要了,但是不加又不好(比如'年 月 日'这种文字) ------------
|
|
|
for (let j = spaceIdxArr.length - 1; j >= 0; j--) {
|
|
|
values[i] = values[i].slice(0, spaceIdxArr[j]) + ' ' + values[i].slice(spaceIdxArr[j]);
|
|
|
}
|