f
This commit is contained in:
@@ -1186,10 +1186,14 @@ func (pb *PageBuilder) drawRichTextBlock(pdf *gofpdf.Fpdf, text string, contentW
|
||||
// getContentPreview 获取内容预览(用于日志记录)
|
||||
func (pb *PageBuilder) getContentPreview(content string, maxLen int) string {
|
||||
content = strings.TrimSpace(content)
|
||||
if len(content) <= maxLen {
|
||||
if maxLen <= 0 || len(content) <= maxLen {
|
||||
return content
|
||||
}
|
||||
return content[:maxLen] + "..."
|
||||
n := maxLen
|
||||
if n > len(content) {
|
||||
n = len(content)
|
||||
}
|
||||
return content[:n] + "..."
|
||||
}
|
||||
|
||||
// wrapJSONLinesToWidth 将 JSON 文本按宽度换行,返回用于绘制的行列表(兼容中文等)
|
||||
|
||||
Reference in New Issue
Block a user