Skip to main content
Participant
April 5, 2019
Answered

extract data from pdf form

  • April 5, 2019
  • 1 reply
  • 2695 views

I created a pdf form to send to users to fill out and send back to me.  The fields include texts, numbers, and a jpeg picture.  How can I extract the picture that was uploaded in the pdf form?  And after the form is filled out and they send the submit button (which emails it back to me), can it be sent back to me uneditable?

This topic has been closed for replies.
Correct answer Thom Parker

this is the general code for making a field read only

this.getField("myField").readonly = true;

you can automate the process of extracting images with a batch process. Take a look at the Action Wizard Toolbar.

1 reply

Thom Parker
Community Expert
Community Expert
April 5, 2019

As far as sending the form "uneditable". You can add a script to the submit button that makes the fields read only. 

Saving pictures in a usable format is an issue. First, you don't know the original format of the image, the user could add anything to the picture field. But that's not the issue, I assume you want it as a JPEG.  Here's an easy way.

1) Use a script to export the data as an FDF using the "doc.exportAsFDF". But only export the picture field.

2) Create a one page PDF form with a button field of the same name as the picture field on the PDF.

3) Import the FDF into the new form to transfer the picture.

4) Use a script to resize the button field to the native image size. It may need to resize the page as well.

5) Save as JPEG.

There are other methods. For example you can write a program or plugin to extract the binary data from the FDF file, most likely this JPEG. Or create a bitmap file from the image data in JavaScript. Or flatten the PDF and use the Extract images option, or Edit images in the "Edit PDF" panel.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
April 5, 2019

What is the script I can add to the submit button that would make the fields read only when I submit?  I'm not an adobe Pro DC expert.  Exporting the picture will not be easy from what you described.  I will need to do this to about 500 returned forms which will be tedious.

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
April 5, 2019

this is the general code for making a field read only

this.getField("myField").readonly = true;

you can automate the process of extracting images with a batch process. Take a look at the Action Wizard Toolbar.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often