Я заменяю поля TextFields на подпись и не могу видеть эти пустые поля подписи в сгенерированном PDF-файле. Эти пустые поля будут необходимы для цифровой подписи клиента на последующих этапах.Не вижу поля пустой подписи, добавленного в PDF
/// <summary>
/// Adds a text field to the report that the user can update signatures to the specified location.
/// </summary>
/// <param name="writer">pdfwriter of document.</param>
/// <param name="xPosition">The lower left x position of the text field.</param>
/// <param name="yPosition">The lower left y position of the text field.</param>
/// <param name="width">The width of the text field.</param>
/// <param name="height">The height of the text field.</param>
/// <param name="fieldId"></param>
protected virtual void AddTextField(iTextSharp.text.pdf.PdfWriter writer, String fieldId, float xPosition, float yPosition, float width, float height)
{
Rectangle position = new Rectangle(xPosition, yPosition, xPosition + width, Math.Max(yPosition - height, 0));
iTextSharp.text.pdf.TextField field = new iTextSharp.text.pdf.TextField(writer, position, fieldId);
// Requirement is to change existing textFields to blank Signature fields
// In the method, memoryStream, reader and stamper are not available.
// Below is the textField I need to transform into Signature field.
// field.Text = String.Empty;
// field.Font = FontFactory.GetFont("Arial Narrow").BaseFont;
// field.TextColor = Color.WHITE;
// field.FontSize = 9;
// Not seeing the signature field appear on the pdf.
// Don't know exactly the reason
PdfFormField sig = PdfFormField.CreateSignature(writer);
sig.SetWidget(position, null);
sig.Flags = PdfAnnotation.FLAGS_PRINT;
sig.Put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g"));
sig.FieldName = fieldId;
sig.SetPage();
writer.AddAnnotation(sig);
//Also tried below code
//PdfFormField pfield = PdfFormField.CreateSignature(writer);
//pfield.FieldName = fieldId;
//pfield.SetFieldFlags(PdfAnnotation.FLAGS_PRINT);
//pfield.SetWidget(position, null);
//pfield.SetPage();
//pfield.MKBorderColor = Color.BLACK;
//pfield.MKBackgroundColor = Color.BLUE;
//PdfAppearance tp = PdfAppearance.CreateAppearance(writer, width, height);
//tp.Rectangle(position);
//tp.Stroke();
//pfield.SetAppearance(PdfAnnotation.APPEARANCE_NORMAL, tp);
//writer.AddAnnotation(pfield);
}
Второй квест: * Мне действительно нужно поле подпись, если - клиент будет добавить текст подписи к этим полем на более поздних стадиях (с использованием 3-й инструмент партии, как DocuSign)? или простые PDFTextFields действительно будут работать?
Добавление вышеуказанного вопроса с запросом, поскольку это может быть полезно при связывании моего сценария.
Заранее благодарим за помощь.