Hi
I am trying to edit the pdf using acrobat reader and getting error that the document has been signed and cannot be edited.
I have change the pdf and removed all signatures by using aspose.PDF version 20.5 using c# .net framework 4.5, when I am opening the edited pdf there is no digital signature present.
Here is my code snippet for the same
// Create PdfFileSignature object
PdfFileSignature pdfSign = new PdfFileSignature();
// Open PDF document
pdfSign.BindPdf(f_outputPDF);
List<String> sigNames = (List<string>)pdfSign.GetSignNames();
foreach (String sigName in sigNames)
{
pdfSign.RemoveSignature(sigName);
}
// Save updated PDF file
pdfSign.Save(f_outputPDF);
Also sharing test pdf for the sametest.pdf (120.3 KB)
Thank you.
@1634197292815
The PdfFileSignature.RemoveSignature method removes the signature according to the name of the signature. You are facing the expected behavior of Aspose.PDF. If you want to remove the signature but keep the signature field, please use PdfFileSignature.RemoveSignature method (String, Boolean) as shown below.
pdfSign.BindPdf(MyDir + "test_2.pdf");
List<String> sigNames = (List<string>)pdfSign.GetSignNames();
foreach (String sigName in sigNames)
{
pdfSign.RemoveSignature(sigName, false);
}
// Save updated PDF file
pdfSign.Save(MyDir + "21.12.pdf");
Moreover, please read the following article.
Remove Signature but Keep the Signature field
Hi @tahir.manzoor I read the documentation and I want to edit the pdf and acrobat is giving me prompt that the pdf cannot be edited because it is digitally signed so I have to remove digital signature completely so I used pdfSign.RemoveSignature(sigName); to remove sign completely. After that still I am getting same prompt.
@1634197292815
You are using old version of Aspose.PDF. Please use the latest version of Aspose.PDF for .NET 22.1 to avoid this issue.
Hi @tahir.manzoor I have tried with 22.1 version but still getting same issue.
Please let me know the solution Thanks.
@1634197292815
We have logged this problem in our issue tracking system as PDFNET-51355. You will be notified via this forum thread once this issue is resolved.
We apologize for your inconvenience.
Hi @tahir.manzoor can you please provide me the estimated date for solution.
Thanks.
@1634197292815
Currently, your issue is pending for analysis and is in the queue. Once we complete the analysis of your issue, we will then be able to provide you an estimate.
Hi @tahir.manzoor is there any update regarding this issue
How much time do you required to provide us updated dll?
@1634197292815
Please use the following code example to get the desired output.
PdfFileSignature pdfSign = new PdfFileSignature();
pdfSign.BindPdf(dataDir + "test.pdf");
List<string> sigNames = (List<string>)pdfSign.GetSignNames();
foreach (string sigName in sigNames)
{
pdfSign.RemoveSignature(sigName, true);
}
pdfSign.Save(dataDir + "out.pdf");
//Flatten
var doc = new Document(dataDir + "out.pdf");
doc.Flatten();
doc.Save(dataDir + "out_flatten.pdf");
I have made changes in the code still its not working getting same error.
@1634197292815
Please use the latest version of Aspose.PDF for .NET 22.3. If you still face problem, please share the problematic PDF file here for further testing.