This commit is contained in:
2025-12-04 10:35:11 +08:00
parent b0e8974d6c
commit 68def7e08b
7 changed files with 184 additions and 154 deletions

View File

@@ -637,14 +637,10 @@ func (pb *PageBuilder) addHeader(pdf *gofpdf.Fpdf, chineseFontAvailable bool) {
// 绘制logo如果存在
if pb.logoPath != "" {
if _, err := os.Stat(pb.logoPath); err == nil {
// gofpdf的ImageOptions方法调整位置和大小左边距是15mm
pdf.ImageOptions(pb.logoPath, 15, 5, 15, 15, false, gofpdf.ImageOptions{}, 0, "")
pb.logger.Info("已添加logo", zap.String("path", pb.logoPath))
} else {
pb.logger.Warn("logo文件不存在", zap.String("path", pb.logoPath), zap.Error(err))
pb.logger.Warn("logo文件不存在", zap.String("path", pb.logoPath))
}
} else {
pb.logger.Warn("logo路径为空")
}
// 绘制"天远数据"文字(使用中文字体如果可用)