简体   繁体   English

如何在Win Forms或WPF中访问Acrobat PDF Viewer中加载的PDF

[英]How to access PDF loaded in Acrobat PDF Viewer In Win Forms OR WPF

Problem: I have a WPF application which is hosting a Win Form User Contorl inside it which then hosts Adobe PDF reader inside it. 问题:我有一个WPF应用程序,该应用程序内部托管有一个Win Form User Contorl,然后在其中托管了Adobe PDF阅读器。 I am able to load a PDF file into the user control and then display the PDF file in the WPF application. 我能够将PDF文件加载到用户控件中,然后在WPF应用程序中显示PDF文件。 Now the PDF file is an editable PDF file. 现在,PDF文件是可编辑的PDF文件。 So the user has got some boxes on it and they can add text into it. 因此,用户在其上有一些框,他们可以在其中添加文本。

Is there a way to read the already loaded PDF file with the input from the end user into either bytes or an array list or something. 有没有一种方法可以读取最终用户输入的已加载的PDF文件,并将其读取为字节或数组列表等。 I just want the user to click a button called "Submit" and the application should read the content of the document in the Adobe Reader control and either submit it to a database or to an XML file. 我只希望用户单击一个名为“提交”的按钮,应用程序应读取Adobe Reader控件中文档的内容,然后将其提交到数据库或XML文件。

I have had a look at paid editions of PDF viewer which do something similar but would prefer a free control which would allow me to achieve this. 我看过PDF查看器的付费版本,它们的功能类似,但希望使用免费控件使我能够实现这一目标。

One way I know of is to submit form data to your server and process the data on the server. 我知道的一种方法是将表单数据提交到服务器并在服务器上处理数据。

Adobe Reader can be used to submit form data in either FDF (Forms Data Format), XFDF (a version of FDF based on XML) or even PDF. Adobe Reader可用于以FDF(表单数据格式),XFDF(基于XML的FDF版本)或PDF提交表单数据。 You just have to properly setup your PDF. 您只需要正确设置PDF。 The document has to have a submit button (a button with Submit-Form action). 该文档必须具有一个提交按钮(带有“ Submit-Form操作的按钮)。

You might want to take a look at Form submit / eMail demystified for additional information. 您可能需要查看神秘的表单提交/电子邮件以获得更多信息。

Figured out how it can be done and just posting the answer for anyone else knowledge. 弄清楚如何完成,然后将答案发布给其他人。 1. Export the current PDF into XFDF format. 1.将当前PDF导出为XFDF格式。 (Thanks to Bobrovsky for pointing it out). (感谢Bobrovsky指出)。 2. Have a XML reader which will read this XFDF. 2.拥有一个XML阅读器,它将阅读该XFDF。 3. render the XML into a HTML file on the web. 3.将XML呈现为Web上的HTML文件。 4. Get the user to input the information into the HTML page. 4.让用户将信息输入HTML页面。 5. on submit of the page, you should have the XFDF mapped into a list of string and you will get your code base to match the incoming data with the collection of string. 5.在提交页面时,您应该将XFDF映射到字符串列表中,并且您将获得代码库,以将传入数据与字符串集合进行匹配。 6. once this is done, you can then either save the data as XFDF file or into a database. 6.完成后,您可以将数据另存为XFDF文件或保存到数据库中。

Its a bit of a long winded process but it does get round the issue of users who do not have Acrobat Reader installed on their local machine. 这有点漫长的过程,但是确实解决了在本地计算机上未安装Acrobat Reader的用户的问题。

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

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