We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Upload a PDF and extract XML

I am trying to test the aspose-pdf-kit-4.1.0-java.zip api for extracting XML from a give PDF.

I have seen the sample code which doesn’t work for me since it extracts from file system and writes to file system.

Basically I want to extract the XML from the PDF file that is uploaded by the user to the J2EE server through a browser. After that I will parse the XML and save data to DB.

Please let me know if this API can help in any way?

Thank you

Gopal

Hi Gopal,

You may first save the uploaded PDF file to your server and then export the data to XML file. Does that work for you? If it doesn’t help then please elaborate your scenario, so we could guide you accordingly.

Regards,

Thank you Shahzad,


The solution that you gave will not work as we are not allowed to store on a file system in J2EE environment.

I can pass byte[] (byte array) as an input and I want the out put to be byte[].
I don’t no if aspose has other classes that can be used before XML export.

Regards
Gopal

Hi Gopal,

Please try to use the constructor of the Form class which takes input and output file parameters as streams:

Form(java.io.InputStream srcStream,java.io.OutputStreamd stStream)

You may also use the overload of the exportXml method which allows you to save the output XML file to a stream object.

exportXml(java.io.OutputStream xmlOutputStream)

After that, you can process the output XML stream in your code as you like.

I hope this helps. If you find any further questions, please do let us know.
Regards,

Thank you Shahzad,


That solves my problem. I don’t know how I missed that:)

Gopal