Expand my Community achievements bar.

Form Server Submit QPAC problem

Avatar

Former Community Member
Hi folks,

I was trying to create a simple workflow which converts an iPDF(read from disk) and convert it to an XML using form server submit QPAC. I tried both assigning values to input/put variables and setting external input data as XML.



The parameters I assigned are as follows

Input

------

input Document--> /process_data/@pdfdocument( pdfdocument is a document type)

option --> PDFtoXDP=true

Request Headers --> CONTENT_TYPE=application/pdf

user id --> administrator

password --> password

Output

--------

Output XML --> process_data/xml_data (xml_data is XML type)



It conks by giving the following message

"com.adobe.formServer.interfaces.ProcessFormSubmissionException: com.adobe.formServer.interfaces.FormServerException: com.adobe.pdf.exceptions.PDFParseException: could not find xref section"



Please help!!!!



-Thanks

Kailash
7 Replies

Avatar

Level 9
Hi Kailash



How did you load the PDF from the file system into the document variable?

It sounds like Forms doesn't think the data inside your DOcument variable is a PDF.

Also, is the PDF a PDF that was originally designed in LC Designer?



Howard

http://www.avoka.com

Avatar

Former Community Member
Hello Howard,

Thanks for reply.


1."How did you load the PDF from the file system into the document variable?"

> I using FileInputStream to a Document object as follows

> InputStream is = new FileInputStream(new File("c:\\XXX.pdf"));

> byte[] data = null;

> data = new byte[is.available()];

> is.read(data);

> Document d = new Document(data);

> patExecContext.setProcessDataDocumentValue("/process_data/@pdfdocument", d)


2.Also, is the PDF a PDF that was originally designed in LC Designer?

> Yes! It is designed using LC designer.



Thanks

-Kailash

Avatar

Former Community Member
I'd guess that you're not reading the entire file in yoru code, so it's an incomplete PDF and that's why it complains about not being able to find the XREF section. Try using code like this to read the file:



ByteArrayOutputStream bos = new ByteArrayOutputStream();

int num = 0;

int i = 0;

while (true) {

byte[] temp = new byte[1024];

num = bis.read(temp);

if (num == -1) {

break;

}

bos.write(temp, 0, num);

}

bos.flush();

data = bos.toByteArray();



where bis would be your FileInputStream.



Or alternatively take a look at the com.adobe.idp.Document constructors that take a File object or InputStream instead of a byte array.



> PDFtoXDP=true



I don't think you need this option, that should be for converting an Acrobat PDF to an XDP.



Chris

Adobe Enterprise Developer Support

Avatar

Level 9
If you'd like a quick way to test whether this is the problem, download our DOcument Import QPAC from:

http://www.avoka.com/avoka/qpac_library.shtml

This has been tested for various variable types, including Document, binary, String and XML.

Howard

Avatar

Former Community Member
Hello Chris,

I got it resolved and your suggestions helped a lot to get a resolution. Some how it was not able to read last portion of the file when I used FileOuputStream directly.



Thanks a lot for your help.



Have a good day

-Kailash

Avatar

Former Community Member
Hi Howard,

I could resolve this with the help of Howard.

Thanks a lot for your concern and time.



Have a nice day

-Kailash

Avatar

Level 9
Hi

The Javadoc for FileINputStream says:

This method ATTEMPTS to completely fill the buffer, but can return before doing so.

It doesn't say why, but I guess this is what's going on.

Howard