Extract PDF form data using JavaScript and write in the CSV file

I received a PDF file with a form.  The form is * not * formatted as a table.  My requirement is to extract form field values and write into a CSV file that can be imported into Excel.  I tried using the menu item "Merge data from spreadsheet files" automated in Acrobat Pro, but the release includes both the labels and values.  I'm mostly just interested in the form field values.

I would use JavaScript to extract the data from the form and learn JavaScript write CSV file (since I know what should look like the spreadsheet of end).  I got regarding the extraction of the fields in the form:

this.getField("Today_s_Date").value;

And the rest of this post: http://StackOverflow.com/questions/17422514/how-to-write-a-text-file-in-Acrobat-JavaScript , I tried to write to CSV using:

var cMyC = "abc";

var doc = this.createDataObject ({cName: "test.txt", cValue: cMyC});

but I get the following error:

"SyntaxError: syntax error".

1:Console:Exec ".

Ideally, I don't want to use a third-party tool online to make, because the data are sensitive.  But please let me know if you have any suggestions.  The ideal output is a CSV file that an end business user can open in Excel to see the format of spreadsheet of his choice.

Did anyone done this before?  Open to hearing alternatives as well.  Thanks in advance!

The code you have posted works fine for me in the JavaScript console, so I suspect the problem is something else. Where did he put the code and y at - he seized another code?

In addition, if CSV is not a strong requirement, I would say that you use delimited by tabs instead. Fields normally cannot contain tab characters, this is a good qualifier to use. It will be also more reliable when you import in Excel. If you need to process the field data that may contain quotes, you need prepare correctly the string data and can use a JavaScript library like this: https://github.com/uselesscode/ucsv

Tags: Acrobat

Similar Questions

  • The monitoring of test data to write in the CSV file

    Hi, I'm new to Labview. I have a state machine in my front that runs a series of tests. Every time I update the lights on the Panel with the State. My question is, how is the best way to follow the test data my indicators are loaded with during the test, as well as at the end of the test I can group test data in a cluster, and send it to an another VI to write my CSV file. I already have a VI who writes the CSV file, but the problem is followed by data with my indicators. It would be nice if you could just the data stored in the indicators, but I realize there is no exit node =) any ideas on the best painless approach to this?

    Thank you, Rob

    Yes, that's exactly what typedef are to:

    Right-click on your control and select make typedef.

    A new window will open with only your control inside. You can register this control and then use it everywhere. When you modify the typedef, all controls of this type will change also.

    Basically, you create your own type as 'U8 numéric', 'boolean', or 'chain' except yours can be the 'cluster of all data on my front panel' type, "all the action my state machine can do," etc...

  • How to write in the csv file - what's wrong with that?

    Hi all

    I created a view that makes all kinds of calculations, now I need to write the output in the csv file. How can I do this through a procedure? Sorry I've never had to create a csv file before and this is my first time.


    Thank you!

    Published by: user5737516 on November 18, 2009 09:47

    See:
    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:1992907061984
    (points to several other links)
    and/or
    http://tkyte.blogspot.com/2009/10/httpasktomoraclecomtkyteflat.html

  • Can all help with VI to get data (HEX) serial number and write in the text file

    Hello I am struggling with this problem for 2 months... They get help from different I thought I solved the problem, but of no use yet I stand on zero

    Problem: I need to get data on USB high speed HEXAGON shaped (coming in hexadecimal and be stored in the text file to the hexadecimal format as each hexadecimal value online different I'll also to attach the file)

    Get us ASCII on series or VISA read but when trying to convert to hex as shown in text file making it slower to deal with code, I know that my VI will have to improve more... I'm waiting for suggestions

    Need urgent help...

    Thanks in advance

    Hi Ali Afzal,.

    I think that the attached example can work for you. If not, then try the solution with sending the data to a parallel running the loop and store it there.

    Mike

  • Need help: UTL_FILE read and write in the text file

    Hello, I'm on version 11 GR 2 by using the UTL_FILE function to read a text file and then write the lines where it starts with the word "foo" and put an end to my writing in the text file where the line with the word "ZEN". Now I have several lines that begin with 'foo' and 'ZEN' allow a paragraph, and in this paragraph, there is a line that begins with "DE4.2". Therefore,.
    I need to write all of the paragraphs that include the "DE4.2" line in their beginning and end of lines 'foo' and 'ZEN '.

    FOR EXAMPLE:

    FOO/234E53LLID
    IT'S MY SECOND LINE
    IT'S MY THIRD LINE
    DE4.2 IT OF MY FOURTH LINE
    IT'S MY FIFTH LINE
    ZEN/DING3434343

    FOO/234E53LLID
    IT'S MY SECOND LINE
    IT'S MY THIRD LINE
    IT'S MY FIFTH LINE
    ZEN/DING3434343

    I'm only interested in writing the first paragraph tha includes line DE4.2 in one of the paragraph of lines not the second ther that does not include the "DE4.2".

    Here is my code so far:

    CREATE OR REPLACE PROCEDURE my_app2 IS
    Utl_file.file_type INFILE;
    outfile utl_file.file_type;
    buffer VARCHAR2 (30000);
    b_paragraph_started BOOLEAN: = FALSE; -flag to indicate which required paragraph is started

    BEGIN
    -Open a file to read
    INFILE: = utl_file.fopen ('TEST_DIR', 'mytst.txt', 'r');
    -Opens a file for writing
    outfile: = utl_file.fopen ('TEST_DIR', "Out.txt", "w");

    -Check the file is open
    IF utl_file.is_open (infile)
    THEN
    -lines in the file in loop
    LOOP
    BEGIN
    UTL_FILE.get_line (infile, buffer);
    APPLICATION STARTING POINT-
    Buffer IF LIKE 'foo %' THEN
    b_paragraph_started: = TRUE;
    END IF;
    -SEARCH FOR GRADS APPS
    IF b_paragraph_started AND buffering LIKE '% 4% ' THEN
    UTL_FILE.put_line (outfile, buffer, FALSE);
    END IF;
    -REQUEST FOR ENDPOINT
    Buffer IF LIKE '% ZEN' THEN
    b_paragraph_started: = FALSE;
    END IF;
    UTL_FILE.fflush (outfile);

    EXCEPTION
    WHEN no_data_found THEN
    EXIT;
    END;
    END LOOP;
    END IF;
    UTL_FILE.fclose (INFILE);
    UTL_FILE.fclose (outfile);
    EXCEPTION
    WHILE OTHERS THEN
    raise_application_error ("-20099, ' UTL_FILE unknown error");
    END my_app2;
    /

    When I run this code I get only one line: DE4.2 it ME LACK THE WHOLE PARAGRAPH

    PLEASE ADVISE...

    I agree with reservations of Justin on the length of a "paragraph" and the number of users that are running at the same time, so here is a version without the collections.

    CREATE or replace PROCEDURE my_app2 IS
       infile utl_file.file_type;
       outfile utl_file.file_type;
       buffer VARCHAR2(30000);
       b_paragraph_started BOOLEAN := FALSE; -- flag to indicate that required paragraph is started
       b_toprint BOOLEAN := FALSE;
       l_para_start pls_integer;  -- start of "paragraph"
    BEGIN
       infile := utl_file.fopen('TEST_DIR', 'mytst.txt', 'r');
       outfile := utl_file.fopen('TEST_DIR', 'out.txt', 'w');
       LOOP
          BEGIN
             utl_file.get_line(infile, buffer);
             IF buffer LIKE 'FOO%' THEN
                b_paragraph_started := TRUE;
                l_para_start := UTL_FILE.FGETPOS(infile) - (length(buffer) + 1);
             END IF;
             IF b_paragraph_started and buffer like '%DE4%' THEN
                b_toprint := TRUE;
             END IF;
             If buffer like 'ZEN%' THEN
                IF b_toprint THEN
                   UTL_FILE.FSEEK(infile, l_para_start);
                   utl_file.get_line(infile, buffer);
                   while buffer not like 'ZEN%' loop
                      utl_file.put_line(outfile,buffer, FALSE);
                      utl_file.get_line(infile, buffer);
                   end loop;
                   utl_file.put_line(outfile,buffer, FALSE);
                end if;
                b_paragraph_started := FALSE;
                b_toprint := false;
                utl_file.fflush(outfile);
             end if;
          EXCEPTION
             WHEN no_data_found THEN
                EXIT;
             END;
       END LOOP;
       utl_file.fclose(infile);
       utl_file.fclose(outfile);
    END my_app2;
    

    Test:

    SQL> !cat mytst.txt
    FOO/234E53LLID
    THIS IS MY SECOND LINE
    THIS IS MY THIRD LINE
    DE4.2 THIS IS MY FOURTH LINE
    THIS IS MY FIFTH LINE
    ZEN/DING3434343
    
    FOO/234E53LLID
    THIS IS MY SECOND LINE
    THIS IS MY THIRD LINE
    THIS IS MY FIFTH LINE
    ZEN/DING3434343
    
    FOO/234E53LLID again
    THIS IS MY second SECOND LINE
    THIS IS MY second THIRD LINE
    DE4.2 THIS IS MY second FOURTH LINE
    THIS IS MY second FIFTH LINE
    ZEN/DING3434343 again
    
    SQL> exec my_app2;
    
    PL/SQL procedure successfully completed.
    
    SQL> !cat out.txt
    FOO/234E53LLID
    THIS IS MY SECOND LINE
    THIS IS MY THIRD LINE
    DE4.2 THIS IS MY FOURTH LINE
    THIS IS MY FIFTH LINE
    ZEN/DING3434343
    FOO/234E53LLID again
    THIS IS MY second SECOND LINE
    THIS IS MY second THIRD LINE
    DE4.2 THIS IS MY second FOURTH LINE
    THIS IS MY second FIFTH LINE
    ZEN/DING3434343 again
    

    You may need to change the length (buffer) + 1 depending on your platform and if you want a blank line s NLE out paragraphs, add another call to put_line after that outside of the loop in the fi l_toprint block.

    John

  • How to catch exceptions and write in the text file

    For all developers,.

    This is the problem,

    I want to print my exception stack trace in a text file.

    This developer can know and analyze on what function is error and what exception for this error...

    Is it possible to do this?

    Thank you...

    Yes, you can write like try (), it returns a string, and you can write that string to the file.

  • I need to simplify the csv of a pdf form data extraction

    I have a complex PDF with fields to fill out. Once these are met, I want to extract the data in the fields, for insertion into a database.

    I know that I can use the form to prepare, then more. Export data... will create a .fdf file. Then I can use Merge Data Files into spreadsheet... to generate a .csv file that contains all the data in. Then, I wrote code to extract this data and put it in my database of mssqlserver.

    Several steps are required and I'd like to simplify as much as possible.

    From the very beginning.

    1. when I select export data, I am presented with a dialog box that uses 'Adobe_data.fdf Test' as the default file name. This default can be changed? By default, he can name that I used last time?

    2. when I select merge data files into spreadsheet I am presented with a dialog box requesting the file. It cannot by default the file .fdf, that I just created? This dialog box includes a check box (last Include list of files to export data since) but I don't want the latest list, I want the .fdf file I just created by default. In addition, this procedure aims to 'fusion' of the data files. I want to just "merge" one file! The only reason I use it is it seems to be the only way to convert the .fdf in a (pseudo) - implemented) .csv file.

    3. when I click on 'Export' in the dialog box, I have to retype the name of the file .fdf, since this type of file is not a part of the 'save as type' so I can't return the name.

    4. This step ends with another dialog (export Progress) with a View file buttons now and dialogue narrow. I have to click the close dialog box.

    It sounds like a large number of steps, and it will be more difficult it should be to train someone to review these procedures.

    Is there a better (easier way?

    Thank you.

    roricka

    You call with each click a 'step '? It is a bit exaggerated...

    Anyway, you export the values of a single file or several files? If a single file then this task can be scripted, Yes, and the script can be attached to a button that can be triggered by a simple click.

    If several files, then it is much more complicated and would require using an Action and a button, and I don't think that he will save "measures", compared to the original function.

  • Distribute PDF forms to collect information and track their status†

    Hello

    Comparison of the versions of Acrobat (http://www.adobe.com/products/acrobat/matrix.html) there is:

    Distribute PDF forms to collect information and track their status†

    and on the bottom:

    For ad-hoc distribution and collection forms data for up to 500 people.

    This means that only 500 people can send the form to the server acrobat.com?

    Or only 500 Forms supports can be made? Only 500 lines in my tracking page?

    What happens if I check my answers?

    I need follow responses of 50 people, but they fill many many forms and I need track responses on their part so I need to know the limits.

    Thanks for the reply in advance.

    Kind regards

    Maciej elkam

    Captatio

    If you activate player rights, allowing the player uses ave files or related items, then you are limited to 500 uses for the presentation. For more details on this topic, read the article 15 of the LICENSE agreement. Otherwise, do not activate the player rights and collect data only, not complements in PDF format.

    For your 50 people, you should probably read the license carefully, but I think that you are covered. The EULA is downloadable from Adobe to review if you don't have Acrobat.

  • Send pdf form data to sql database

    Where can I find detailed information about the process of sending the pdf form data stored on the Web site of the sql database stored on the web server? Where I can find some samples, I could use to build my form and script related.

    Thanks for the tips.

    Tony

    If you want the form to communicate directly with the DB, you need to configure a DSN on each of the machines, which will take place in the form. Note that this wil only work on Windows machines. Also, the form must be started for the script runs (you mentioned the PDF has been stored on the web server). I have some examples that show how to deal with a DB, but attachments do not seem to work properly on the forum yet. If you cannot retrieve post them your email and I will send them to you directly.

    Paul

  • We write plain HTML5, JavaScript and CSS in the development of webworks BB 10.

    Hi all

    We write plain HTML5, JavaScript and CSS in the development of webworks BB 10.

    Thank you all

    Yes.

    Here is an example of an application named BrickBreaker which was written entirely in HTML5, JavaScript and CSS.  It can be pacakged in BlackBerry 10 application using SDK WebWorks:

    https://github.com/BlackBerry/BB10-WebWorks-community-samples/tree/master/BrickBreaker

  • I do my job to the computer on a MAC computer. I want to create a document using Pages and then convert the document to PDF and send a group email. I want to send the PDF using the pdf for each receiver icon must click the icon to open t

    I do my job to the computer on a MAC book PRO. I want to create a document using Pages and then convert the document to PDF and send a group email. I want to send the PDF using the pdf for each receiver icon must click the icon to open the document. My problem is the document does not show the icon, but rather the document is already open. I spoke with 2 Apple. 'Experts' care and can help me. Can someone tell me what to do?

    It's a question of how the recipients e-mail programs deal with attachments. Many e-mail programs will open all the files they can handle, including files jpg and PDF, by default, and if the recipient has not changed that there is nothing you can do about it. The only solution is to the compress first, then it will be delivered as an attachment, allowing the recipient to decompress and open it.

  • If it's possible... desktop PC, I want to export data using expdp and dumpfile goes to his local directory?

    Scanario

    1 Server Machine (database software)

    2 oracle installed Client workstation

    If it's possible... desktop PC, I want to export data using expdp and dumpfile goes to his local directory?

    Rajesh

    Hello

    You can use this method

    http://dbaharrison.blogspot.de/2013/05/expdp-creating-file-on-my-local-machine.html

    But it depends on having you another instance on your workstation also.

    Otherwise, you will need to sort the database drive will appear on the desktop or vice versa using nfs/samba etc.

    See you soon,.

    Rich

  • Unable to export of form data using FormDEfUtil.cmd

    Hi all

    I am not able to make the export of form data using FormDEfUtil.cmd.

    D:\hyperion\planning\bin\FormDEfUtil.cmd export < formname > localhost < appname > admin password

    I get this message when tried the script above in cmd invite below.

    use: HspFormDefUtil < import/export > < filename/formname /-all > < Server > < username > < password > < application >.

    Any help is appreciated.

    Thank you!!

    Rev

    It is certainly the correct admin account details, you can log in with the details of account planning

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • list box given to the .csv file using write on the worksheet File.vi

    Hi, I use the write on the worksheet File.vi to write data multicolumn ListBox to the .csv file. If I do record from Excel, the pop-up window shows as an attachment. And data listbox are too different.  I want the data displayed in the first line not the second row (third photo).

    Thank you for your help.

    Before making your Save As in Excel, change the cell formatting of number. This should avoid the scientific notation conversion before you re-register.

    Or just use Notepad to display the file instead of Excel.

  • Read a record of file and write to the database.

    Hello

    I read a file using a file adapter and write to the database using DBAdapter table. In BPEL, I used activity to receive the entry from the file and call activity to call dbadapter.in between receive and call I used activity activity of transformation of transformation.the problem is that, after deployment it.i get following error two errors:

    (1) no recoverable system failure:
    < bpelFault > < faultType > 0 < / faultType > < bindingFault xmlns = "http://schemas.oracle.com/bpel/extension" > < a name = "summary" part > < summary > Exception is is produced when the link has been invoked. Exception occurred during invocation of the JCA binding: "JCA binding run reference"insert"operations have to: connection problem component binding JCA.". JCA Binding component is unable to create an outgoing connection of JCA (CCI). ReadWriteDB:WriteDB [WriteDB_ptt::insert (MydbCollection)]: The JCA Binding component could not establish an outbound connection of JCA CCI due to the following problem: BINDING. Error of JCA - 12510 JCA adapter localization resources. Unable to locate the adapter of JCA resource through the element of the binding file .jca & lt; factory connections / > The JCA Binding component is unable to startup of the resource adapter specified in the & lt;-factory connections / > element: location = 'EI, DB, null. The reason is most likely that 1) the resource adapter RAR file has not been deployed successfully to the WebLogic application server or 2) the "& lt;" jndi name > ' element in weblogic - ra.xml has not been defined in eis/DB/null. In the latter case, you need to add a new factory of connections from WebLogic JCA (deploy a RAR). Please fix this and then relaunch the Application Server, please make sure that the JCA connection factory and dependent connection factories have been set up with a sufficient limit for maximum connections Please also make sure that the physical connection to the EIS server is available and the backend itself accepts connections. ". The called JCA adapter threw an exception of resource. Please review the error message above carefully to determine a resolution. < Summary / > < / part > < part name = "detail" > < details > error location JCA resource adapter. Unable to locate the adapter of JCA resource through the element of the binding file .jca & lt; factory connections / > The JCA Binding component is unable to startup of the resource adapter specified in the & lt;-factory connections / > element: location = 'EI, DB, null. The reason is most likely that 1) the resource adapter RAR file has not been deployed successfully to the WebLogic application server or 2) the "& lt;" jndi name > ' element in weblogic - ra.xml has not been defined in eis/DB/null. In the latter case, you need to add a new factory of connections from WebLogic JCA (deploy a RAR). Please fix this and then restart the application server < / details > < / part > < part name = "code" > < code > 12510 < / code > < / piece > < / bindingFault > < / bpelFault >

    2 non recoverable system fault):
    Exception occurred when the link was invoked. Exception occurred during invocation of the JCA binding: "JCA binding run reference"insert"operations have to: connection problem component binding JCA.". JCA Binding component is unable to create an outgoing connection of JCA (CCI). ReadWriteDB:WriteDB [WriteDB_ptt::insert (MydbCollection)]: The JCA Binding component could not establish an outbound connection of JCA CCI due to the following problem: BINDING. Error of JCA - 12510 JCA adapter localization resources. Cannot find the adapter in JCA resources via the element of the binding .jca file <-factory connections / > The JCA Binding component is unable to startup of the resource adapter that is specified in the <-factory connections / > element: location = 'EI, DB, null. The reason is most likely that 1) the resource adapter RAR file has not been deployed successfully to the application server WebLogic or 2) the element '< jndi name >' in weblogic - ra.xml has not been set to eis/DB/null. In the latter case, you need to add a new factory of connections from WebLogic JCA (deploy a RAR). Please fix this and then relaunch the Application Server, please make sure that the JCA connection factory and dependent connection factories have been set up with a sufficient limit for maximum connections Please also make sure that the physical connection to the EIS server is available and the backend itself accepts connections. ". The called JCA adapter threw an exception of resource. Please review the error message above carefully to determine a resolution.

    Please suggest how to solve.

    Thank you

    Tejas

    Check your source data and your connection adapter db adpater deployments factory.
    Check if you have configured all steps of http://docs.oracle.com/cd/E15523_01/integration.1111/e10231/life_cycle.htm#BABBEDBF.
    Also, in your file .jca in your jdeveloper have named the location of connection-factory as "ist/DB/draw ' if so change it to one that you have created in the db adapter deployments.

Maybe you are looking for

  • Why the guarantee is estimated August?

    I bought the iPhone certified re-machined 6 but check tells me that the estimated expiration date: 7 August 2016. It seems that it has been used, but I bought it via seller confidence in Europe and in this device. I do not have unboxed it yet so I ca

  • Satellite L10-117 and memory upgrade problem.

    I installed the module of ram kingston 512 MB dedicated for my laptop and my system does not start. Laptop does not see its partition with windows. I tried to salvage the dvd system and he does ' t help. Recovery is going ok but after restart problem

  • New case of old for the M40X 129?

    Hi, I was looking for on the site toshiba.de and to my surprise, the MX40-129 photo and specifications have changed!Obviously the older case of the M30X series is used and no mention of the harman kardon spreakers. To be honest, it would be good news

  • How to implement CLAHE with Labview

    Hello world I want to use the clahe method to improve the contrast of the image. Unfortunately, there is not any vi in this regard in vision modules of NOR. Research Web information site, there is a possible way to do it. In other words, build a *.dl

  • How can I get rid of open with time ever I click on the icons on the home page it come open with

    I tried everthink I can think, but he is always helping me