Copy link to clipboard
Copied
I am new here and trying to post a query here. I have a pdf form with over 50 fields including signature box. I want to export the values as well as field names to excel sheet using javascript so when clicked a button, it creates a file and each field name goes to a new column and below that column in the row it's value also exported. I hope here are many experts who knows how to do it. I tried with other example but not satisfied with the result I wanted. Example attached what solution I expect from you.
Thanks in advance!
Regards,
Royan
Copy link to clipboard
Copied
You can use the exportAsText method of doc object.
Copy link to clipboard
Copied
I already have a PDF form saved with filled in data or I can fill in later too. Field names are having underscore and values will be either space separated and there is a text box which will have more text lines. Is it not possbile to click on a button and then export the field names and values into Excel sheet? One more question, the field names are showing in ascending order in Excel file when exported from .csv file, not in the same order in which fields names already provided to the fields. I tried using the function this.exportAsText({ cName:'output.csv', nLaunch:'2'}); and I was able to get the result in .csv file which I then imported into Excel sheet, but that too ascending order. Thanks for your prompt reply.
Copy link to clipboard
Copied
exportAsText has not the parameter cName and nLaunch
Copy link to clipboard
Copied
You can do it using the built-in Export Form Data command. Select the output format as "text file" and it will generate a tab-delimited .txt file with exactly this structure, which you could then open in Excel. It won't include the details of the signature, though.
Copy link to clipboard
Copied
Hi Try,
Thank you for trying to provide the solution to my problem. I am attaching a screenshot which is not what I need. I wrote this.exportDataObject({ cName:'output.csv', nLaunch:'2'}); and the answer is like this.
Copy link to clipboard
Copied
I don't understand. So you already have the data file saved as an attachment to the PDF file?
Also, are you sure the values are comma-separated, and not tab-delimited? If the latter, the file extension should be txt, not csv.
Copy link to clipboard
Copied
Yes, I already have a PDF form saved with filled in data or I can fill in later too. Field names are having underscore and values will be either space separated and there is a text box which will have more text lines. Is it not possbile to click on a button and then export the field names and values into Excel sheet? One more question, the field names are showing in ascending order in Excel file when exported from .csv file, not in the same order in which fields names already provided to the fields. I tried using the function this.exportAsText({ cName:'output.csv', nLaunch:'2'}); and I was able to get the result in .csv file which I then imported into Excel sheet, but that too ascending order. Thanks for your prompt reply.
Copy link to clipboard
Copied
If you want to define the order of the fields then you have to generate the file using a script.
Copy link to clipboard
Copied
You will need a custom script to do this. Find information and tools on scripting form data here:
https://www.pdfscripting.com/public/Form-Data-Handling.cfm
Contact me if you custom development.