From 8b8421a16b566828b4e7f909838bd96ef20a1660 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A2=93=E5=BD=AD?= Date: Wed, 22 Apr 2026 07:57:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=81=E4=B9=A6=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Certificate/CertificateGenerateService.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/YD_Event.Application/Certificate/CertificateGenerateService.cs b/YD_Event.Application/Certificate/CertificateGenerateService.cs index b37a9d0..e8b597b 100644 --- a/YD_Event.Application/Certificate/CertificateGenerateService.cs +++ b/YD_Event.Application/Certificate/CertificateGenerateService.cs @@ -1338,9 +1338,11 @@ public class CertificateGenerateService : IDynamicApiController, ITransient .FitArea(); } - // 使用绝对定位来放置文本内容(更精确) - page.Content().Layer(layer => + // 使用 Column 来放置所有内容,但禁用默认间距 + page.Content().Column(column => { + column.Spacing(0); + double? firstParagraphY = null; double? firstParagraphOriginalY = null; @@ -1375,11 +1377,8 @@ public class CertificateGenerateService : IDynamicApiController, ITransient _logger.LogDebug("段落 {Index} 位置: X={X}, Y={Y}", i + 1, x, y); - // 使用绝对定位放置文本 - var textElement = layer - .TranslateX(x) - .TranslateY(y) - .Text(paragraph.Text) + // 使用 Translate 来定位,配合 Spacing(0) 确保没有额外间隔 + var textElement = column.Item().TranslateX(x).TranslateY(y).Text(paragraph.Text) .FontSize((float)fontSize) .FontColor(QuestPDF.Helpers.Colors.Black) .AlignLeft();