Adjust signature box layout and add background color
Updated the signature box proportions by adjusting `imgRatio` to 52% and `textRatio` to 43%. Added a cream-tone background with extra padding (`bgPad`) and rendered it behind the signature content. Tightened gaps between the image, separator line, and text area. Increased text row height slightly for better spacing.
This commit is contained in:
@@ -208,13 +208,18 @@
|
|||||||
|
|
||||||
const double sigW = 1.77 * 72; // 127.44 pt
|
const double sigW = 1.77 * 72; // 127.44 pt
|
||||||
const double sigH = 1.96 * 72; // 141.12 pt
|
const double sigH = 1.96 * 72; // 141.12 pt
|
||||||
const double imgRatio = 0.60; // top 60% = image
|
const double imgRatio = 0.52; // top 52% = image (was 0.60)
|
||||||
const double textRatio = 0.38; // bottom 38% = text (2% padding)
|
const double textRatio = 0.43; // bottom 43% = text (was 0.38)
|
||||||
|
|
||||||
var black = PdfSharp.Drawing.XColor.FromArgb(255, 20, 20, 20);
|
var black = PdfSharp.Drawing.XColor.FromArgb(255, 20, 20, 20);
|
||||||
var darkGray = PdfSharp.Drawing.XColor.FromArgb(255, 80, 80, 80);
|
var darkGray = PdfSharp.Drawing.XColor.FromArgb(255, 80, 80, 80);
|
||||||
var lineColor = PdfSharp.Drawing.XColor.FromArgb(180, 100, 100, 120);
|
var lineColor = PdfSharp.Drawing.XColor.FromArgb(180, 100, 100, 120);
|
||||||
|
|
||||||
|
// Background: paper/cream tone, no border
|
||||||
|
var bgColor = PdfSharp.Drawing.XColor.FromArgb(255, 255, 253, 240);
|
||||||
|
var bgBrush = new PdfSharp.Drawing.XSolidBrush(bgColor);
|
||||||
|
const double bgPad = 3.0; // extra padding around the signature box (pt)
|
||||||
|
|
||||||
var fontBold = new PdfSharp.Drawing.XFont("Arial", 7.5, PdfSharp.Drawing.XFontStyleEx.Bold);
|
var fontBold = new PdfSharp.Drawing.XFont("Arial", 7.5, PdfSharp.Drawing.XFontStyleEx.Bold);
|
||||||
var fontNormal = new PdfSharp.Drawing.XFont("Arial", 6.5, PdfSharp.Drawing.XFontStyleEx.Regular);
|
var fontNormal = new PdfSharp.Drawing.XFont("Arial", 6.5, PdfSharp.Drawing.XFontStyleEx.Regular);
|
||||||
var linePen = new PdfSharp.Drawing.XPen(lineColor, 0.5);
|
var linePen = new PdfSharp.Drawing.XPen(lineColor, 0.5);
|
||||||
@@ -239,6 +244,10 @@
|
|||||||
double x = field.X;
|
double x = field.X;
|
||||||
double y = field.Y;
|
double y = field.Y;
|
||||||
|
|
||||||
|
// --- Background rectangle (drawn first, sits between PDF and signature) ---
|
||||||
|
var bgRect = new PdfSharp.Drawing.XRect(x - bgPad, y - bgPad, sigW + bgPad * 2, sigH + bgPad * 2);
|
||||||
|
gfx.DrawRectangle(bgBrush, bgRect);
|
||||||
|
|
||||||
// --- Image area ---
|
// --- Image area ---
|
||||||
double imgH = sigH * imgRatio;
|
double imgH = sigH * imgRatio;
|
||||||
var imgRect = new PdfSharp.Drawing.XRect(x, y, sigW, imgH);
|
var imgRect = new PdfSharp.Drawing.XRect(x, y, sigW, imgH);
|
||||||
@@ -248,13 +257,13 @@
|
|||||||
gfx.DrawImage(xImg, imgRect);
|
gfx.DrawImage(xImg, imgRect);
|
||||||
|
|
||||||
// --- Separator line ---
|
// --- Separator line ---
|
||||||
double lineY = y + imgH + sigH * 0.01;
|
double lineY = y + imgH + sigH * 0.005; // was 0.01 — tighter gap after image
|
||||||
gfx.DrawLine(linePen, x + 2, lineY, x + sigW - 2, lineY);
|
gfx.DrawLine(linePen, x + 2, lineY, x + sigW - 2, lineY);
|
||||||
|
|
||||||
// --- Text area ---
|
// --- Text area ---
|
||||||
double textY = lineY + 2;
|
double textY = lineY + 1; // was +2 — tighter gap below line
|
||||||
double textH = sigH * textRatio;
|
double textH = sigH * textRatio;
|
||||||
double lineH = textH / 3.5; // max 3 text rows
|
double lineH = textH / 3.0; // was /3.5 — rows closer together
|
||||||
double padding = 3;
|
double padding = 3;
|
||||||
|
|
||||||
// Row 1: FullName (bold)
|
// Row 1: FullName (bold)
|
||||||
|
|||||||
Reference in New Issue
Block a user