0

I have a .pdf created through Adobe LiveCycle Designer (it's a dynamic pdf ) i want to add this pdf to my windows app

this is what i tried

File file1 = new File(fileName);
System.Xml.XmlDocument xfadoc = new System.Xml.XmlDocument();
xfadoc.LoadXml(fileName);

here's how i get filename

OpenFileDialog dialog = new OpenFileDialog();
dialog.InitialDirectory = "c:\\";
dialog.Filter = "pdf files (*.pdf) | *.pdf | All Files (*.*) | *.* | xdp files (*.xdp) | *.xdp ";
dialog.FilterIndex = 2;
dialog.RestoreDirectory = true;
dialog.CheckFileExists = true;
dialog.DefaultExt = "pdf | xdp";
fileName = dialog.FileName.ToString();

but when i click on open file button and browse to where i have stored it ; it doesnot even appear

Also when i try to load this file in my C# windows app it gives me an exception at the following line

 xfadoc.LoadXml(fileName);

the exception says that

'Data at root level is invalid'

If i say that i have loaded the string (filepath name) someone please tell me how can i extract the xml part only form this dynamic file

Alexandru Deliu
  • 546
  • 3
  • 17
  • Traditionally, it's been better to tell us _which_ exception you received. You should include the results of `ex.ToString()`. – John Saunders Dec 05 '12 at 13:13

2 Answers2

0

Try Filter without spaces in extensions part.

dialog.Filter = "pdf files (*.pdf)|*.pdf|All Files (*.*)|*.*|xdp files (*.xdp)|*.xdp";
arunes
  • 3,464
  • 2
  • 21
  • 31
0

LoadXml loads the document from the string parameter. You want to use the Load method.

John Saunders
  • 160,644
  • 26
  • 247
  • 397