These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

readerExtensions don't save pdf with dynamic fields

Barthuin
Registered: Apr 24 2008
Posts: 45
Answered

Hi all,

I have a problem with a pdf created with LC Forms with some dynamic fields but, when I use ReaderExtensions with it and set some rights in it, the dynamic fields aren't saved. I use these rights;

UsageRights useRight = new UsageRights();
useRight.setEnabledDynamicFormFields(true);
useRight.setEnabledFormDataImportExport(true);
useRight.setEnabledDynamicFormPages(true);

I have tried to set the same rights using the webUI but it doesn't work.

Is neccesary another kind of rights? How can I do for saving these dynamic fields?

Any suggestion is appreciated. Thanks in advance

Dani

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I take it that you are using the LC servers? because this certainly isn't client side JavaScript. You know, when you post these questions its a good idea to let us in on you're situation (what tool are you using, where is this script used, etc.). Otherwise nobody knows what you are talking about.

In order to save a PDF with entered data it needs "Form Save Rights". And you don't even need to Rights Server to do this. It can be done with Acrobat Professional. Try it.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Barthuin
Registered: Apr 24 2008
Posts: 45
Hi Thomp. Thanks for your response. I will try to explain my problem better. I have a web application with a servlet which calls to LC Form to get a pdf form and show to the user in the web browser.

LC Form and LC Reader Extensions are installed in another server (JBoss running on RedHat). When servlet send a request to LC Form, this gets a xdp created by LC Designer, render it as pdf form and send to the servlet again which show it to the user. This step works fine. I have the problem in the next step.

Before LC Form send the pdf form to the servlet I want to set save rights to this pdf using LC Reader Extension. And here is where I have my problem. The pdf form has dynamic fields and when I open it, i can save it with its entered data except these dynamic fields. I have tried to save the form without rights and, using Reader Extension webUI, set these rights again but it doesn't work.

I know this question can be in the wrong forum but I have asked in other Java forums and LC Forms and ReadExtensions forums and I hadn't any response

If someone has an idea about this problem or know how can it be solved, his suggestion is appreciated

Thanks in advance.
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
In addition to what you're already doing, add the following:

useRight.setEnabledFormFillIn(true);

Geogre
Barthuin
Registered: Apr 24 2008
Posts: 45
Hi George and thanks for your response. i have tried adding all rights in my java code and it doesn't work. I have tried adding all rights in Reader Extension web UI too and it doesn't work neither.

Can this problem be about a problem with my Reader Extension credential? i use this trial credential http://www.adobe.com/go/reader_ext_cert

Thanks in advance for your help

Dani
George_Johnson
Expert
Registered: Jul 6 2008
Posts: 1876
When you say "it doesn't work", what do you mean exactly? Is your code failing? Is the document not getting any usage rights applied? Is the form not fillable in Reader? Or is the form not saveable in Reader?

I have no way of verifying the credential you're using.

George
Barthuin
Registered: Apr 24 2008
Posts: 45
The form is created correctly, with save rights and all fields datas are saved except dynamic fields (the form has static fields like name, address, phone... and a dynamic table with two columns, province and city. You can add one or more rows on this table but these new rows haven't never saved)

Dani
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
This is very odd, if data from one field is being saved, then all the data should be saved. I would advise you to verify exactly what data is and is not saved in the XDP data model.

There are a couple of easy ways to do this. First, export data to XML from Acrobat Pro. For data in repeated subforms the XML should contain repeated subform tags. If this data is imported into a blank form, it should force new repeatable subforms to be created.

Second, look at the data model directly. After saveing the form, run this code from the console window

xfa.data.saveXML('pretty');

It will expose all the data that has been saved in the form.

Another possibility is that one of the rights you are applying is blocking the dynamic nature of the PDF. You know, rights not only grant privileges on Reader, they also block functionality not associated with the right. I don't know which one might be doing this, it's just something to think about.

If you don't find a solution then I think you may be right that the demo license is doning somthing to block operation, but I find that hard to believe. Sounds more like a bug to me.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Barthuin
Registered: Apr 24 2008
Posts: 45
At first, thomp and George_Johnson thank you very much for your help. It was very useful.

i have resolve my problem. The last thomp's post gave me an idea about the real problem . I will try to explain it.

My xdp has a data connection with an xml. For this dynamic table, my xml has this structure (sorry but it's in spanish)

I had a problem before with this structure because I had to add new "tramo" in my xml for each row added dynamically. So I fixed this with three new fields "provinciasTotal", "carreterasTotal" and "localidadesTotal" associatted with my xml and these new fields had the values of all "provincia" fields, "carreteras" field and "localidades" field. For example, If I added two rows with "value1" and "value2" like values in "provincia" field, then "provinciaTotal" had the value "value1#value2". And the same situation with "carreterasTotal" and "localidadesTotal".

So, my problem saving my form was that "provincia", "carreteras" and "localidades" were never saved. But I didn't realize that "provinciaTotal", "carreterasTotal" and "localidadesTotal" had their values saved. Then, I had to modify my pdf. I had to do a new action in "initialize" event. In this event, I do a split for each "xTotal" field getting the values in an array. Then, for each element of my array, I add a new row in my dynamic table (because the dynamic table is empty when you open the pdf) and add each element in the right field.

I don't know if this is the right solution but it works fine (I hope my explanation would be clearly). Thank you again, thomb and George_Johnson, for your help. It's a pleasure to be in this kind of forums with people who can help bennigger like me

Regards
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Ahh, you didn't say that you had special data binding on the form. This would absolutely do it. Acrobat will only export bound fields in this case and in the format determined by the XML template used for the binding.

Sorry I didn't ask about this earlier:(

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Barthuin
Registered: Apr 24 2008
Posts: 45
It was my fault because i didn't explain it very well. Now, I have another problem, but more easy, I think so.

I can save my form with all datas but i want to save it using a button. I'm going to explain better.

I have a submit button that send my form to a servlet which insert it in a database. I want that when I click on this button but before to submit the pdf, save my pdf. For do this, I have tried with

App.executeMenuItem("SaveAs");

but I had this error "App.executeMenuItem("SaveAs");"

I have tried using this code

var mydoc = event.target;
mydoc.saveAs();

getting this error (it's a translation, original error is in spanish)

"the security configuration not allow to access to this property or method"

Why are these errors if the pdf has the save rights and I can save it using "File -> Save as" ? Why not with these methods?Thanks in advance. Regards
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
First, the "App" in "App.executeMenuItem()" is a syntax error. It should be "app". However, the "SaveAs" menu item is not availible for a script running inside a PDF. This is security restriction.

The "doc.saveAs()" fucntion is heavily restricted, You can't really call it from a PDF, even if the file has Save Rights. In the Acrobat JavaScript reference it states that this function can only be called from a privileged context.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Barthuin
Registered: Apr 24 2008
Posts: 45
Hi thomp, thanks for your response. I didn't know that. But I have try with this code

app.execMenuItem("SaveAs")

and it works fine.

thanks agains for your help

Cheers