I have Digitally Signed a PDF named as "Original" with Succes Message : "Signed and all signatures are valid." When i try to modify that pdf's data using below code and open the document named as "NewlyCreated" ,signatures become invalid with Error Message : AtLeast one signature is valid
public class Program
{
public const String src = @"C:\Original.pdf";
public const String dest = @"C:\NewlyCreated.pdf";
public void createPdf1(String dest)
{
PdfReader reader = new PdfReader(src);
PdfDocument pdfDoc = new PdfDocument(reader,new PdfWriter(dest),new StampingProperties().UseAppendMode());
PageSize ps = pdfDoc.GetDefaultPageSize();
Paragraph p = new Paragraph("This is the text added in the rectangle.");
PdfCanvas canvas = new PdfCanvas(pdfDoc.GetFirstPage());
Rectangle rect = new Rectangle(ps.GetWidth() - 90, ps.GetHeight() - 100, 50, 50);
new Canvas(canvas, pdfDoc, rect)
.Add(p);
canvas.Rectangle(rect);
canvas.Stroke();
pdfDoc.Close();
}
public static void Main(string[] args)
{
Program objProgram = new Program();
objProgram.createPdf1(dest);
}
}
How can i modify pdf without invalidating its signature using iText7