What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Adding image to PDF form

    Asked by vikramsonawane on January 25, 2017 at 03:31 AM

    Hi,

     

    I have created a form using JotForm and I'm filling up the form programmatically (using iText). I'm able to fill text field values without any issue. Problem is I'm not able to see the image field when I scan through the form I created using JotForm; Once I'm able to get an handle to the image field, I'll be able to populate the image.

    Any help on this would be much appreciated.

    Thanks,

    VS

  • Profile Image
    JotForm Support

    Answered by Jim_R on January 25, 2017 at 04:13 AM

    Hello VS, we can better understand how to help if you could share more information on what you're doing (and how you're doing it) via iText.

    IINM, you're using iText to programmatically fill out the form, and you mentioned it works great, except for the image field.

    Can you give us a bit of background on how you're doing it? Are you using our APIs? Also, which iText are you using specifically - This one http://itextpdf.com/ or this one https://sourceforge.net/projects/itext/ 

  • Profile Image

    Answered by vikramsonawane on January 25, 2017 at 04:24 AM

    Hi Jim_R,

    We are using iText 7 API (http://itextpdf.com/) and reading the form using Pdf AcroForm API (PdfAcroForm.getAcroForm) & then getting all the fields present on the form using form.getFormFields().

    Issue is that I'm able to see all the fields other than the image field that I originally added during form creation on JotForm website.

  • Profile Image
    JotForm Support

    Answered by Jim_R on January 25, 2017 at 04:43 AM

    Thanks for clearing that up. Do you have a text dump or log of what you're getting when you use the form.getFormFields() class?

    It's a bit hard for us to do blind troubleshooting and debugging. I'm also citing our Developers Forum and API documentation to see if you can find some info on this. We also have a separate and dedicated team that you can reach at api@jotform.com but for now, let us know if you have something that will help us figure out why the image field is not present.

  • Profile Image

    Answered by vikramsonawane on January 25, 2017 at 05:00 AM

    Hi Jim_R,

    Following is the form screen shot.

     

    and following is the map content for the getFormFields() method call - 

    {formID=com.itextpdf.forms.fields.PdfTextFormField@610694f1

    website=com.itextpdf.forms.fields.PdfTextFormField@43814d18

    pdf_submission=com.itextpdf.forms.fields.PdfTextFormField@5c5a1b69

    simple_spc=com.itextpdf.forms.fields.PdfTextFormField@3701eaf6

    q15_name[first]=com.itextpdf.forms.fields.PdfTextFormField@627551fb

    q15_name[last]=com.itextpdf.forms.fields.PdfTextFormField@2b552920

    q16_yourEmail16=com.itextpdf.forms.fields.PdfTextFormField@2758fe70

    q22_phoneNumber22[area]=com.itextpdf.forms.fields.PdfTextFormField@1f36e637

    q22_phoneNumber22[phone]=com.itextpdf.forms.fields.PdfTextFormField@578486a3

    q17_yourMessage=com.itextpdf.forms.fields.PdfTextFormField@551aa95a

    q23_preferredContact=com.itextpdf.forms.fields.PdfButtonFormField@35d176f7

    q23_preferredContact.1=com.itextpdf.forms.fields.PdfButtonFormField@1dfe2924

    q23_preferredContact.2=com.itextpdf.forms.fields.PdfButtonFormField@6ebc05a6

    q25_occupation[Owned Business]=com.itextpdf.forms.fields.PdfButtonFormField@6e6c3152

    q25_occupation[Salaried]=com.itextpdf.forms.fields.PdfButtonFormField@50b494a6

    q25_occupation[test]=com.itextpdf.forms.fields.PdfButtonFormField@3cef309d}

     

    If you notice the highlighted text, it hasn't returned the field information pertaining to the form image placeholder.

  • Profile Image
    JotForm Support

    Answered by Jim_R on January 25, 2017 at 06:21 AM

    That was helpful and you're correct. The Image Field was not included on the map content you posted:

    I can only assume that, that method is only gathering "actual input fields" and skips anything that is not an input field (in this case, an Image Field). There's a way for us to test this with your help.

    Try adding a Text Field to your form and run the method again.

    If form.getFormFields() will skip that too, then we can safely deduce that it's only generating results from input fields.

  • Profile Image

    Answered by vikramsonawane on January 25, 2017 at 06:44 AM

    Thanks Jim_R, that makes sense. Is there a way I can have image as input field in JotForms?

  • Profile Image
    JotForm Support

    Answered by Jim_R on January 25, 2017 at 07:50 AM

    Glad everything's cleared up now. But I'm afraid what you're asking is not possible. Textboxes, Checkboxes, Radio Buttons, and any field that requires user input are the only ones considered as input fields.

    The rest that only serves to display information (e.g. Text Field, Image Field, and perhaps our Form Collapse and Page Break tools) can never be considered as an input.

  • Profile Image

    Answered by vikramsonawane on January 27, 2017 at 08:16 AM

    Hi Jim_R,

    Is there a way I could have my own field names. Just to give an example, in my earlier response I have share the content of the fields map:

    ...

    q15_name[first]=com.itextpdf.forms.fields.PdfTextFormField@627551fb

    q15_name[last]=com.itextpdf.forms.fields.PdfTextFormField@2b552920

    q16_yourEmail16=com.itextpdf.forms.fields.PdfTextFormField@2758fe70

    q22_phoneNumber22[area]=com.itextpdf.forms.fields.PdfTextFormField@1f36e637

    ...

    Every field is prefixed with some details (q15_, q16_, etc). In the field level configuration, I just have name, yourEmail16, etc. Why is it adding the suffix & is there a way I could not have that?

  • Profile Image
    JotForm Support

    Answered by Chriistian on January 27, 2017 at 09:43 AM

    The field name prefix on the provided content cannot be removed or replaced. The prefix (q15_, a16_, etc.) are system generated. You can only update the Unique Name of the field in your form. This is the name that comes after the prefix.

    Do let us know if you need further assistance.
    Regards.