export/import form fields to a variable string javascript

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
amrkamal63
User
Posts: 6
Joined: Mon Jul 29, 2019 11:21 am

export/import form fields to a variable string javascript

Post by amrkamal63 »

Hi,
I have a form that have a primary key which I currently store it's form fields as normal pdf form
making every form which has a different key into a different pdf form file ,
ok ,
what do I need now is to change this way instead of saving the file into different pdf forms with different names
I want to keep all different values in the same form by using XML and saving values into a variable string using a javascript
function exportAsXFDFstr keep storing all different form values into one variable string ,and then restore or populate the form values
from this string without the need to save them at all on many pdf forms only in the original one original form ,
how do, I import values from such variable string ,
I want to keep saving the fields into one variable string in javascript and before I close the pdf I will save the value of this
string to a annotation.contents

second when I import the XML into a database such as ACCESS it would take the whole xml as consecutive records or rows
so import all records and rows all at once in an ACCESS database without the need to import each record or row individually

your help and support is highly appreciated
Br



what I do need is
I have questions regarding export/import all form fields to a variable string by a javascript function exportAsXFDFStr
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17901
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: export/import form fields to a variable string javascript

Post by Tracker Supp-Stefan »

Hello amrkamal63,

You seem to have found the exportAs... methods in the JS API, and there are the inverse methods of importAnFDF and importAnXFDF (on page 316-317 of this document):
https://www.adobe.com/content/dam/acom/ ... erence.pdf

For the further work with the database - I believe you will most likely need to parse the .xml file and then input it in the database using other tools - JS inside PDFs will not allow you to work with the DB directly, so you will need something else and I am not able to advise what that might be.

Regards,
Stefan
Post Reply