Hi Everybody! I Have a big problem....i have created with Open Office a doc file with fields and converted it in PDF.
I have done the match of the PDF file with PDF Sharp, but the result is like this:
I have the merged text twice. The code is the following:
Code:
PdfDocument document = PdfReader.Open(pathFileDestinazione + docTemp.NomeFile, PdfDocumentOpenMode.Modify);
PdfAcroForm form = document.AcroForm;
PdfAcroField.PdfAcroFieldCollection fields = form.Fields;
string[] names = fields.Names;
names = fields.DescendantNames;
for (int idx = 0; idx < names.Length; idx++)
{
string fqName = names[idx];
PdfAcroField field = fields[fqName];
PdfTextField txtField;
txtField = (PdfTextField)field;
switch (txtField.Name)
{
case "/txtMartello":
case "/txtAttrezzatura":
txtField.Text = reader["Descrizione"].ToString(); ;
break;
case "/txtMatricola":
txtField.Text = reader["Matricola"].ToString(); ;
break;
case "/txtLuogo":
txtField.Text = reader["LuogoConsegna"].ToString(); ;
break;
case "/txtData":
txtField.Text = DateTime.Now.ToShortDateString();
break;
case "/txtDitta":
case "/txtRagioneSociale":
txtField.Text = reader["RagioneSocialeAcquirente"].ToString(); ;
break;
case "/txtCollaudatore":
txtField.Text = reader["riferimentocollaudatore"].ToString();
break;
case "/txtDittaCollaudo":
txtField.Text = reader["RagioneSocialeCollaudatore"].ToString();
break;
case "/txtDataCollaudo":
txtField.Text = reader["DataCollaudo"].ToString().Substring(0, 10);
break;
default:
txtField.Text = " ";
break;
}
}
Any suggestion? What's wrong??
Thanks in advance