Expand my Community achievements bar.

SOLVED

Extracting Xml from a PDF

Avatar

Former Community Member

Hi

I have a requirement like after user fills the PDF form, The user should be able to save the XML of that PDF form in his/her local machine.

We have to provide a button which prompts user for the save dailog box to save the XML.

Is this possible in Designer? If yes, how

Pls help.

Thanks

Abhiram

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Did you select "import/export data"?

LC Screenshot blur.jpg

Try paring back the script to xfa.host.exportData();

Check the JavaScript console (Control+J) when opened in Acrobat and see if any errors come up when the button is clicked.

Niall

View solution in original post

11 Replies

Avatar

Level 10

Hi Abhiram,

The you can import and export data from a form in Acrobat.

If the user has Reader then they will only be able to import/export XML if the form has previously been Reader Enabled using the full LC Reader Extensions ES2 server product.

See summary here: http://assure.ly/gYyYc2.

Please note that if a form has been Reader Enabled in Acrobat, then the ability to import/export XML is still not available AND it will also not be available in Acrobat.

Hope that helps,

Niall

Avatar

Level 2

Before applying User Rights (RM) or Reader Extended(RE), in the designer , you must write this piece of JavaScript on 'click' of the button

xfa.host.exportData("",0);

------------------------------------

param1

(Optional)

Specifies the location and file name of the file where the data will export. If you omit this parameter, a dialog box opens to let the user select the file

manually.

param2

(Optional)

Specifies the export format for the data.

true | 1 (JavaScript) or 1 (FormCalc) (Default)

Export to XDP format.

false | 0 (JavaScript) or 0 (FormCalc)

Export plain XML data.

Note, the above piece of code will only if you apply any RE or RM.

Regards,

skriw

Avatar

Former Community Member

Hi skriw,

I have wriiten  xfa.host.exportData("",0); in a Regular button click event.

After that i have reader extended the form as mentioned by you.

Still, the finctionality is not working. let me knw if i am doing something wrong.

Pls help.

Thanks

Abhiram

Avatar

Level 10

Hi,

How have you Reader Enabled the form?

Did you Reader Enable in Acrobar OR in LC Reader Extensions ES2?

Niall

Avatar

Former Community Member

Hi,

Yes. I have reader enabled the form using LC Reader Extensions ES2.

Thanks

Abhiram

Avatar

Correct answer by
Level 10

Hi,

Did you select "import/export data"?

LC Screenshot blur.jpg

Try paring back the script to xfa.host.exportData();

Check the JavaScript console (Control+J) when opened in Acrobat and see if any errors come up when the button is clicked.

Niall

Avatar

Former Community Member

Hi,

Further, there is another requirement.

The buttton which we use to export the XML data should be of  SUBMIT TYPE, But in submit type we cannot handle the click event.

Is there any way to save the XML locally now?

Thanks

Abhiram

PS: The reason for a submit type button is to validate the form before saving the XML.

Avatar

Level 2

Hi Abhiram,

What kind of validation you want to do before generating XML?

Actually, even I tried Submit type option. It only works over email, webservice etc.

Regards,

skriw

Avatar

Former Community Member

Hi Skriw,

I want my client side validations to fire before saving it to XML.

Avatar

Level 2

You could use 2 buttons.

One hidden button will have Control Type of Submit, and Submit As of XML/XDP.

The visible button will be Regular and in the Click event handler, execute the validation code, then the "Click" event of the hidden (Submit) button.