Search code examples
c#wpfwinformspdfpdfviewer

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. I am able to load a PDF file into the user control and then display the PDF file in the WPF application. Now the PDF file is an editable PDF file. 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. 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.

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.


Solution

  • Figured out how it can be done and just posting the answer for anyone else knowledge. 1. Export the current PDF into XFDF format. (Thanks to Bobrovsky for pointing it out). 2. Have a XML reader which will read this XFDF. 3. render the XML into a HTML file on the web. 4. Get the user to input the information into the HTML page. 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. 6. once this is done, you can then either save the data as XFDF file or into a database.

    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.