PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Mar 28, 2024 8:19 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Thu Oct 15, 2015 8:18 am 
Offline

Joined: Thu Oct 15, 2015 8:06 am
Posts: 1
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:

Image

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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 100 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group