I have a fill-in PDF that used to use a simple XFDF file to populate. Using VS.NET 2010 I read in the XFDF document and populate all the necessary information and populate the PDF using ds.WriteXML(XFDFName). The XFDF gets written and launched via Process.Start(XFDFName). This is all in a WinForms application. This method has worked like a champ for a few years now. Until now...
The problem I have run into is I was unable to export the data to an XFDF format due to the file having been created in Adobe LiveCycle. I noticed that the export options were either (1) XML or (2) XDP. In the past I'd been able to export to XFDF. No big deal I thought, just another format. However, I have been struggling with both of these options. After some deliberating I decided to use the XDP format.
I have the dataset built with all of the information I need, I am receiving an error when opening the newly created XDP using Process.Start(XDPName). Reader opens and I am greeted with the following error: "Adobe Reader could not open 'GUID_HERE.xdp' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)."
I tried using a straight up href to the PDF, that didn't work either. So I opted to stick the serialized PDF in the XDP in the section.
This XDP file looks like this (thanks Dean J):
<?xml version='1.0' encoding='UTF-8'?>
<?xfa generator='AdobeDesigner_V7.0' APIVersion='2.2.4333.0'?>
<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>
<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>
<xfa:data>
XML is here - matching the dynamic fields in the PDF.
</xfa:data>
</xfa:datasets>
<pdf xmlns=\"http://ns.adobe.com/xdp/pdf/\"><document>
<chunk>
Base64 encoded PDF
</chunk>
</document></pdf>
</xdp:xdp>
I would think the XDP I'm generating is bogus - but to further complicate things - if I open Reader click Tools > Forms > More Form Options > Manage Form Data > Import Data and choose the XDP file that I've generated, all the fields are populated as I expect them to be.
So basically, there is obviously a disconnect somewhere: I have a XDP file with all the information in it I need. I have a PDF form that I need to populate with the XDP file. The information in the XDP properly matches all of the control names from the PDF. But when I fire up the XDP file, Reader is telling me it's broken/not supported. As I understand it, when you launch an XDP file it should properly launch/populate using Reader, correct?
Any information would help me out immensely. Thanks.