Alright, I managed to upgrade the .dll to 4.1.6. I have verified that the
stamper object is not being called in append mode. The signature field is
still not cleared and the field remains signed.
The code has now been changed thusly:
public Boolean ClearSignatureField(string fieldName)
{
try
{
ArrayList list = this.Stamper.AcroFields.GetFieldItem(fieldName);
item.MarkUsed(this.Fields, AcroFields.Item.WRITE_VALUE |
AcroFields.item.WRITE_WIDGET);
int n = item.Size;
for (int k=0; k<n; ++k)
{
ClearSignatureDictionary(item.GetMerged(k));
ClearSignatureDictionary(item.GetWidget(k));
ClearSignatureDictionary(item.GetValue(k));
}
return true;
}
catch(Exception ex)
{
throw new Exception("An Exception has occurred: ", ex);
}
}
private static void ClearSignatureDictionary(PdfDictionary dic)
{
dic.Remove(PdfName.AP);
dic.Remove(PdfName.AS);
dic.Remove(PdfName.V);
dic.Remove(PdfName.DV);
dic.Remove(PdfName.SV);
dic.Remove(PdfName.FF);
dic.Put(PdfName.F, new PdfNumber(PdfAnnotation.FLAGS_PRINT));
}
As you can see, the code now closely more resembles the code updated by
Paulo. The code executes without failure and the field's values are
correctly located. However, the signature field remains signed.
If curious, here is my stamper declaration code:
private void GenerateStamper(bool isAppendMode)
{
bool canCloseReader = false;
if (this.ModifiedStream != null)
{
this.Stamper = new PdfStamper(this.Reader, this.ModifiedStream, '\0',
isAppendMode);
canCloseReader = true;
}
if (canCloseReader)
{
this.Reader.Close();
}
}
isAppendMode is being populated by the value of false during stamper
generation which should be fine.
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/Clearing-a-Digital-Signature-Field-s-value-tp2966934p2993740.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php