refactor(Pdf): Add Background-method to place a background behind the signatures.

This commit is contained in:
2025-09-26 16:00:25 +02:00
parent bf0bd8e9e7
commit 16657f6a31
5 changed files with 45 additions and 47 deletions

View File

@@ -10,8 +10,6 @@ using EnvelopeGenerator.Domain.Constants;
using EnvelopeGenerator.PdfEditor;
using EnvelopeGenerator.Web.Extensions;
using EnvelopeGenerator.Web.Models;
using iText.Kernel.Colors;
using iText.Kernel.Pdf.Canvas;
using MediatR;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authentication.Cookies;
@@ -224,21 +222,7 @@ public class EnvelopeController : ViewControllerBase
{
if (er.Envelope!.Documents?.FirstOrDefault() is DocumentDto doc && doc.ByteData is not null)
{
using var pdf = Pdf.FromMemory(doc.ByteData).Design(1, canvas =>
{
canvas.SetFillColor(new DeviceRgb(135, 62, 35));
canvas.Rectangle(100, 500, 200, 100);
canvas.Fill();
canvas.SetFillColor(new DeviceRgb(222, 220, 215));
canvas.SetStrokeColor(new DeviceRgb(135, 62, 35));
canvas.Circle(300, 500, 100);
canvas.FillStroke();
canvas.Fill();
});
using var pdf = Pdf.FromMemory(doc.ByteData).Background(doc.Elements!);
doc.ByteData = pdf.ExportAsBytes();