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

Submitting form to asp.net server

mcnamara
Registered: Nov 10 2009
Posts: 14
Answered

Hello,

I have several questions about submitting forms to asp.net server.

Let's say I have a form which submits data to asp.net server and submit format is xml data. If the pdf file contains an image will it be included too? If yes what will be the format of the image?

Secondly, if some of the fields are not filled, will they be included in the xml files as empty fields or will they be omited from the xml file altogether?

Finally, after processing the posted data I would like to display a message to user e.g: success or failure. How can I achieve it? I believe I need to set the Response but what should be the format of the response? Will just a plain text work?

Thank you.

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You know, there's a real easy way to test this. Give it a try and find out. You can export directly from the form this the "Forms > Manage Form Data > Export Data..." menu item. Or you could setup your submit button to email the XML data, then save it out of the email when the email client UI pops up. Or you could capture all the XML data in a test ASP.NET script and write it to a file. No matter which method you use you'll get exactly the same result.1. Yes, if the image was set with the "Image Field" then the data will be in the XML, base64 encoded.

2. Yes, all the other fields on the form will also be there, even if they are empty.

The best way to send an intelligent message to the user is with an FDF response. The FDF format can include a "before" script where you can place a single JavaScript alert box with a message for the user. This is all the FDF needs to have, it does not need to, in fact it should not include any return data. You'll need to get the FDF specification and do some testing, or download the FDF Toolkit

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]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

mcnamara
Registered: Nov 10 2009
Posts: 14
Thanks for your answers.

According to http://www.adobe.com/devnet/acrobat/fdftoolkit.php FDF Toolkit is not compatible with Adobe LiveCycle Designer.

Can I just return some other pdf file by using response.redirect to some pdf file?

Thanks.
mcnamara
Registered: Nov 10 2009
Posts: 14
It looks that FDF Toolkit is not for parsing the incoming data. So how can I generate the response with script to show messagebox?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The FDF Toolkit can only parse FDF data. Since your recieving XML data you'll have to parse it with the .Net XML tools. I was suggesting using the FDF Toolkit to prepare the response data only. And the fact is that it isn't really necessary. Since the return FDF contains only a single JavaScript items and no data it can be a simple string.

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]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

mcnamara
Registered: Nov 10 2009
Posts: 14
Thanks, that's what I was thinking about.

So far this is what I managed to do:

%FDF-1.21 0 obj<</FDF<</JavaScript<</Doc 2 0 R/Before (myWelcome();)>>>>>>endobj

2 0 obj[(myWelcome) 3 0 R]endobj

3 0 obj<<>>stream

function myWelcome(){app.alert("Success");}endstream

endobj

trailer

<</Root 1 0 R>>%%EOF

I do not have IIS now so I cannot test it.

Generally will the fdf work if pdf is opened
1. in a browser
2. in adobe acrobat
3. in adobe reader

Thanks very much
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You can test the FDF just simply importing it into Acrobat. It doesn't matter what form is open, since it shouldn't contain any form field data in it.

So, your FDF looks ok, but you don't need the Doc scripts or the separate stream definition. It's only one line of code, you can put it all in the Before string. In fact the Doc script is going to be a problem for reader users. Get rid of it.

If you've got windows you can get a free developer version of IIS for your local system. If you're running XP Pro, its already on your system.

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]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

mcnamara
Registered: Nov 10 2009
Posts: 14
What about this one?

%FDF-1.21 0 obj<</FDF<</JavaScript<</Before  ({app.alert("Hello World")})>>>>>>endobjtrailer<</Root 1 0 R>>%%EOF

Is there a shorter way?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
That's all you need. And there really isn't a shorter way. Of course you don't need the all the tabs and newlines. It can all be scrunched together. And the trailer is unnecessary.

I usually build the FDF string in the .NET program at runtime (the alert message part) to send back a custom message.

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]

Then most important JavaScript Development tool in Acrobat
[url=http://www.pdfscripting.com/public/34.cfm#JSIntro][b]The Console Window (Video tutorial)[/b][/url]
[url=http://www.acrobatusers.com/tutorials/2006/javascript_console][b]The Console Window(article)[/b][/url]

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

mcnamara
Registered: Nov 10 2009
Posts: 14
Thanks, I will try this.