Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Drawing field?

Avatar

Level 2

Does anyone know if there is a way to create a "drawing field"? That is, a field that in the static form would allow the user to click and drag with their mouse to create simple drawings?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

You can set up a button to use Acrobat's Ink Tool; however the form MUST be saved as Static for this to work.

Here is a sample: https://acrobat.com/#d=7x14flq1feFHAvrMGuNOBg

I have two buttons (1) for the Ink Tool and (2) to revert to the Hand Tool. However once the Ink Tool is selected, buttons can't be pressed, so I added another button around the drawing area with script in the mouseExit event to change back to the Hand Tool. This works provided the user is not currently drawing.

Apart from trying to script a mouse tracking / drawing tool this is the easiest solution. It may be that Flex/Flash Builder 4 would be a better option.

Good luck,

Niall

OK, what I have discovered is that if  the form is enabled for comments, the buttons do not appear to work. Therefore if it was going out to users with Reader you would replace the buttons with instructions for the user to select the Pencil Tool from the Tools > Comment & Markup menu.

Here is a version that is not enabled for comments, where the buttons work: https://acrobat.com/#d=4gRWyuvrPz*vRATzlsrxow

This started from here: graphical data input for online forms

View solution in original post

17 Replies

Avatar

Correct answer by
Level 10

Hi,

You can set up a button to use Acrobat's Ink Tool; however the form MUST be saved as Static for this to work.

Here is a sample: https://acrobat.com/#d=7x14flq1feFHAvrMGuNOBg

I have two buttons (1) for the Ink Tool and (2) to revert to the Hand Tool. However once the Ink Tool is selected, buttons can't be pressed, so I added another button around the drawing area with script in the mouseExit event to change back to the Hand Tool. This works provided the user is not currently drawing.

Apart from trying to script a mouse tracking / drawing tool this is the easiest solution. It may be that Flex/Flash Builder 4 would be a better option.

Good luck,

Niall

OK, what I have discovered is that if  the form is enabled for comments, the buttons do not appear to work. Therefore if it was going out to users with Reader you would replace the buttons with instructions for the user to select the Pencil Tool from the Tools > Comment & Markup menu.

Here is a version that is not enabled for comments, where the buttons work: https://acrobat.com/#d=4gRWyuvrPz*vRATzlsrxow

This started from here: graphical data input for online forms

Avatar

Level 2

Thanks a lot Niall! This is exactly what

i was looking for!


Avatar

Level 2

So I ran into a problem. When I load a form data file into my form the signature does not appear. It would seem the drawing info is not being carried into the data file. Any suggestions?

Thanks,

          Ian

Avatar

Level 10

Hi Ian,

I am out of the office today, so can't test. However the drawing is a

"comment and markup". I am fairly sure that it won't get exported with

the XML. When the form is open Acrobat you will see the comments

navigation tab towards the bottom left of the window. If you open the

comments navigation tab, you should see the drawing as a series of

comments.

Now if you open the signed version of the form look in the navigation

tab to see if the comments are there.

Also check if the signature field allows comments (not sure if that is

an option).

Hope that helps,

Niall

Avatar

Level 10

Hi Ian,

I now see that you are referring to a hand-drawn signature rather than a digital signature.

I have reworked the example to include fields: https://acrobat.com/#d=3-9PHIOZg4iBeLtwsJbLHw

I guess you are familiar with importing and exporting data from within Acrobat:

Comments1.png

If you are dealing with comments drawn using the Ink Tool, then you can import and export these separately using the Comments menu:

Comments2.png

Acrobat exports the comments as an "fdf" file, whcih can then be imported into another form.

So if you form has data and comments the export and import will be a two-step process.

While you can script a button to export/import the XML data, I don't think you can do the same for comments. I tried:

app.execMenuItem("Annots:ExportToGeneralFileMenu");

but it did not work.

Hope that helps,

Niall

Avatar

Level 2

Thanks Niall that certainly makes things easier. Just a couple of questions.

1) I have set up an http submit button for this form. Is there a way I can get it to send both the XML data file and the FDF data file?

2) I have added a clear form button the form, but this does not remove comments. I am having trouble finding the correct java directory to create a delete comments button. Do you know if this is possible?

Thanks again for all your help!

Avatar

Level 10

Hi,

You can specify the data to be returned in XDP format, which will include the data and comments/markups. The XDP is a XML file that contains a dataset for the user inputs and the drawing as a series of gestures.

Hopefully this will work for you, because submitting as XDP would seem to cover both raw data and the drawing/signature in ONE operation.

Updated sample here: https://acrobat.com/#d=t-MxMf6*GAArCEJCMa9bJw

I don't think that you will be able to script to remove the comments/markups. There doesn't seem to be a menu item for deleting the comments, so I suspect that it will not be possible to emulate this. The only option that I can see is to open the comments nagivation tab and to manually delete the comments:

Acrobat1.png

I hope that helps,

Niall

Avatar

Level 2

I tested the XDP format, but to no avial. It is importing all of the form datat, but still not the comments.

I also gave the XFD format a try, but obtained the same results.

Have you tested this?

Is there somthing I am doing wrong?

Thanks,

        Ian

Avatar

Level 10

Hi Ian,

Try importing this XDP file into a blank form: https://acrobat.com/#d=vatyovvisfDv2U5QEcIC9Q

From the Forms menu Select Import Data. The exact sub-menu will depend on the version of Acrobat you are using:

Import1.png

Browse to the _data.xdp file (you will need to change the file type to XML Data Packages, which is the XDP type):

Import2.png

That works here (import XDP and export XDP).

Niall

Avatar

Level 2

It would seem I am having very particular problem. I have been exporting and importing XDP files using your example, the form fields will fill out fine and your name shows up every time. The problem is any comments that I add will not be included in the XDP package. I looked at the coment propories of your name and my additions. They are identical. I tried saving the form and then exporting the data, but i get the same result. Any idea why this is happening?

Thanks,

Ian

Avatar

Level 2

I am using Acrobat 9 pro by the way...

Avatar

Level 10

Hi Ian,

I am using Acrobat 9 Pro as well.

First of all here are some files:

Now what I have discovered is that not all XDP files are the same!!!

If you open the last four files in an XML editor or TextPad, then you will see the following:

  1. Exporting data from the menu and select XDP data package exports the rawData BUT NOT the ink tool annotations. This explains why your annotations were not exporting. It appears that my annotations became hard wired into the form - this is why I have uploaded a blank, for testing purposes;
  2. Clicking submit button creates an XDP file (as scripted to do), BUT this time the XDP includes the rawData AND ALSO the annotations, as gestures. This seems OK. BUT when you Form > Manage Form Data > Import Data, the rawData comes in BUT NOT the annotations ????
  3. The FDF file exports the comments as objects and when these are imported by Comments > Import Comments - the annotations come in OK, but as expected not the rawData.

Now I just think this is a bit buggy. If an XDP file is created that includes the gestures (via the submit button), then why are they not being imported? In addition why are the two methods of generating an XDP Data Package giving different results (1) menu export without the annotations and (2) submit XDP with the annotations?

The behaviour is not what a user would expect.

OK, all is not lost.

If simply drag ANY of the three XDP files onto Acrobat then the rawData AND annotations are there (????). Good news, but why?

  • While the export XDP does not include the annotations, it does include a file reference to the original PDF from where it came. This is OK if the exported XDP AND the original PDF are in the same folder or on the same PC. Otherwise you get this error:

Acrobat.png

  • On the other hand the XDP created by clicking the submit button fair much better, because they have the annotations in the XDP file as gestures. So if these are dragged onto Acrobat from any location or on a PC that does not have the original PDF they will open correctly and with the rawData AND annotations.

Phew...

So lessons learnt - if you want to export annotations and rawData use a submit button set to submit XDP data packages. These will work. Exporting from the menu to XDP data packages will not work.

Hope that helps. I will be away from the desk today, but will get emails. Good luck,

Niall

Avatar

Level 2

WOW! You rock Niall

The email submit - drag n' drop method works great

Its been more than a week of you helping me with this. I can't thank you enough!

... but for what it's worth, thanks a lot!

PS. I liked your drawings

your my hero,

Ian

Avatar

Level 10

No problem, glad you have it working!!! 

Just a few things. I have been digging around the XFA specification and XDP is covered in Chapter 23 of the following: Adobe XML forms 2.8  specification

Apparently you can control exactly what goes into the XDP, using xdpContent. I haven't done this, but it is in the specification and the help file.

Also the XDP submit does not automatically embed the PDF, but again this behaviour can be scripted for:

Button1.resolveNode("#event.#submit").embedPDF = "0";

So the XDP files from the submit button in the previous posts do not have the PDF embedded, just a fuller href to the original PDF.

Anyway good luck with that,

Niall

Avatar

Former Community Member

I am quite new at this program, and would like to ask you a question about the diagram area you speak about.

I really like the feature you created, it is exactly what I am trying to do with one of my forms.  I would like to create it in two areas, one for a diagram and one for a signature capture.  I recreated what you have described and have the form set to static, it functions almost as yours does but the final step of marking the page is not occuring.

I was wondering if you could help me work through this?  the form this feature will be on is for internal use only on laptops we control.  I also have to make sure that when the form is saved upon retreival the images can be seen (both on the screen and in a printed version of the report).

Avatar

Level 1

Hi Niall

You had some samples with this post,  Would it be possible to obtain them,  the links in the post do not seem to be working

Thanks

Mike

Avatar

Level 1

Hi MIke,

my name is Torbjörn (Tobbe) from Sweden here, this message was intended for NIall in this forum, but maybe this forum is to old and outdated, i don´t know, but anyway, i see that you also have/had some questions to be answered about Livecycle Designer, please, if you have time and possibilitys, read my question here, and maybe we can help each other out in the future, ok, here´s my original question today, april 23 -2018.

Question:

Right now i am working with Livecycle ES4, and a special form made for dentists. for example, when they ordering dental work from a supplier, in my form there is a field with an illustration of teeth, I want the dentist to draw / sketch upon that picture, (not change the picture itself of course) just add some lines and do some markings, it this possible or do i fight here with windmills? (My document is a static pdf and the submit button will send the filled pdf itself, not necessary to send the XML-data.)

Maybe you have som answer to this, or knowledge about it?

Best regards

Torbjörn