简体   繁体   English

加载Adobe动态表单文件

[英]load an adobe dynamic form file

I have a .pdf created through Adobe LiveCycle Designer (it's a dynamic pdf ) i want to add this pdf to my windows app 我有一个通过Adobe LiveCycle Designer创建的.pdf(这是一个动态pdf),我想将此pdf添加到我的Windows应用中

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 另外,当我尝试在我的C#Windows应用程序中加载此文件时,它在以下行给我一个例外

 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 如果我说我已经加载了字符串(文件路径名),请告诉我如何提取仅来自此动态文件的xml部分

尝试在扩展部分中Filter不带空格的部分。

dialog.Filter = "pdf files (*.pdf)|*.pdf|All Files (*.*)|*.*|xdp files (*.xdp)|*.xdp";

LoadXml loads the document from the string parameter. LoadXml从字符串参数加载文档。 You want to use the Load method. 您要使用Load方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM