Expand my Community achievements bar.

processFormSubmission form submitted as pdf issue

Avatar

Level 2

Hi

I have a scenario where, the form must be submitted as PDF content_type, i.e while designing the form, I am setting the submit form as "PDF" format. I have written a J2EE application that receives the submitted form.  Here is what, I am doing.

Document formData =

new Document(request.getInputStream());

formData.copyToFile(

new File("C:/home1/eformwas/InputFile.pdf"));

I ensured that the submitted content from the web browser is a pdf file by opening the InputFile.pdf in the acrobat reader and I verified that the form is siubmitted with the data that I have posted.

Next step, I wanted to process this form, and extract out some of the data elements in it. Hence I did the following

RenderOptionsSpec processFormSubmissionOptionsSpec =

new RenderOptionsSpec();

processFormSubmissionOptionsSpec.setXMLData(

true);

processFormSubmissionOptionsSpec.setPDF2XDP(

true);

processFormSubmissionOptionsSpec.setExportDataFormat(

"XMLData");

formsResultObject = formsServicesClientObject.processFormSubmission(formData ,

"HTTP_REFERER=referrer&HTTP_CONNECTION=keep-alive& CONTENT_TYPE=application/pdf&CONTENT_TYPE=application/vnd.adobe.xdp+xml&CONTENT_TYPE=text/xml",

"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)",

processFormSubmissionOptionsSpec);

When I execute the above code, I get the following error at processFormSubmission method,

Caused by: com.adobe.livecycle.formsservice.exception.FormServerException: Parse error on document: DataSets error: Parse error on document: FSRequest error:  Content is not allowed in prolog.

Any idea, of what is causing this issue. Can I process a form that is submitted as "pdf" content type.? I guess, I can.

As a cross check, I created the whole scenario by creating a process in the LC process modeller and used the processFormSubmission task of the Forms Service and I was successful in processing the form. Not sure, am I missing to set something in RenderOptionSpec or is this a bug in LC SDK ?

LiveCycle error log, also reports the error when invoked through LC SDK API

[1/26/10 11:13:36:627 EST] 0000008a FormServerExc E com.adobe.livecycle.formsservice.logging.FormsLogger logMessage ALC-FRM-001-016: Parse error on document: DataSets error: Parse error on document: FSRequest error: Content is not allowed in prolog.

However, everything works like a charm if processFormSubmission invoked as part of LC process model. I even downloaded the data part as getOutputXML task in the process model and it looks well formed.

Will greatly appreciate your response.

Many Thanks

Gopala...

3 Replies

Avatar

Level 10

I'm looking at this example from the DevNet site : http://help.adobe.com/en_US/livecycle/9.0/programLC/help/000186.html#1550733

try removing CONTENT_ TYPE=text/xml from the second parameter.

The "Content not allowed in prolog" error usually means the xml is not valid for some reason.

You can definitly process a form that's submitted as a PDF.

Jasmin

Avatar

Level 2

Hi Jasmin,

Thanks for a very quick reply. Appreciated very much. I tried removing the content_type="text/xml" and executed the code. Still it is giving the same issue. I agree, that there is some issue with the xml data. But what surprises me is that the, processFormSubmission task used in the process modeller with same options set as the java code, is not giving this issue. Is this a known issue within in LC SDK ?

Thanks

Gopala...

Avatar

Level 2

Hi,

The issue got resolved. Just posting the solution to benefit other folks who can potentially face the same issue.

It worked by setting the content_type="application/pdf" only in environment buffer parameter of formSubmission when the submitted content is of type pdf.

Actually, I referred to the livedocs adobe article @ http://livedocs.adobe.com/LiveCycle/8.2/programLC/programmer/help/wwhelp/wwhimpl/js/html/wwhelp.htm?...

which specifies the following, which is contradictory to the solution.

"You can also specify multiple content type values such as:

CONTENT_TYPE=application/pdf&CONTENT_TYPE=application/vnd.adobe.xdp+xml

to ensure various form submissions can be used"

Regards

Gopala...