问题描述
我已使用itext7将图像附加到已签名的pdf文档中,但签名无效。有什么解决办法
string source = @"D:\SampleProjects\itext\file\test.pdf";
string target = @"D:\SampleProjects\itext\file\tests.pdf";
string img = @"D:\SampleProjects\itext\file\sign_valid.png";
PdfDocument pdfDocument = new PdfDocument(new PdfReader(source),new PdfWriter(target));
// Document to add layout elements: paragraphs,images etc
Document document = new Document(pdfDocument);
var noofpages = pdfDocument.GetNumberOfPages();
// Load image from disk
ImageData imageData = ImageDataFactory.Create(img);
// Create layout image object and provide parameters. Page number = 1
Image image = new Image(imageData).ScaleAbsolute(100,100).SetFixedPosition(1,25,25);
document.Add(image);
document.Close();
解决方法
这是功能,当文档更改时,签名变得无效。
所以我想说你的问题的答案是否定的。
我建议您在文档签名之前附加图像。