Click here to Skip to main content
15,886,519 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to add data dynamically from an array to existing Xml template in c#. I am fetching data from the PDF File and set to an array and I need to pass the values from the same to respective Xml Nodes

My sample xml will be as below:
<Level>
  <Name>3420042016113757</Name>
  <Attribute>Excellency</Attribute>
  </Level>


What I have tried:

PdfReader pdfReader = new PdfReader(SourcePDFFullPath);
                AcroFields pdfFormFields = pdfReader.AcroFields;
                string PDFFileName = Path.GetFileName(SourcePDFFullPath);
                //Get Template Id from Hidden Field(Template ID set Statically) in SMART PDF
                string TemplateID = pdfFormFields.GetField("hidTemplateId");
                //Get PDF Data in control fields from Hidden  Field(PDF) in SMART PDF
                string CapturedPDFValues = pdfFormFields.GetField("hidPDFDataExport");
                string[] PDFValues = CapturedPDFValues.Split(delimiter1);
Posted
Updated 17-May-17 10:21am
Comments
Maciej Los 17-May-17 10:55am    
Can you share sample PDFValues data?

1 solution

Convert the string array to List<string>
List<string> PDFValues = CapturedPDFValues.Split(delimiter1).ToList();

Now you can add anywhere in the list you want.

Then if need be convert back to an array
PDFValues.ToArray()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900