PDFsharp & MigraDoc Foundation
http://forum.pdfsharp.com/

Problem with rendering in PDFSharp
http://forum.pdfsharp.com/viewtopic.php?f=2&t=3215
Page 1 of 1

Author:  dindi [ Thu Oct 15, 2015 8:18 am ]
Post subject:  Problem with rendering in PDFSharp

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

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/