* 将文本分割成适合PDF页面宽度的行
(
text: string,
maxWidth: number,
font: any,
fontSize: number
)
| 975 | * 将文本分割成适合PDF页面宽度的行 |
| 976 | */ |
| 977 | private splitTextIntoLines( |
| 978 | text: string, |
| 979 | maxWidth: number, |
| 980 | font: any, |
| 981 | fontSize: number |
| 982 | ): string[] { |
| 983 | const lines: string[] = []; |
| 984 | const paragraphs = text.split('\n'); |
| 985 | |
| 986 | for (const paragraph of paragraphs) { |
| 987 | const paragraphLines = this.processParagraphForPDF(paragraph, maxWidth, font, fontSize); |
| 988 | lines.push(...paragraphLines); |
| 989 | } |
| 990 | |
| 991 | return lines; |
| 992 | } |
| 993 | |
| 994 | /** |
| 995 | * 处理单个段落用于PDF |
no test coverage detected