Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Read excel from Acrobat Javascript

Avatar

Former Community Member

Hi,

Our requirement is to upload an excel from pdf form, parse it and display it in table format.

I could get the excel through upload button and the code is given below :

var myDoc = event.target;

myDoc.importDataObject({cName: sFile });

var rstr = myDoc.getDataObjectContents(sFile);

var vFile = util.stringFromStream(rstr, "utf-8");  

But when i print vFile variable value, it is throwing some junk characters.

Please help me in getting the excel data from particular sheet in excel.

Regards,

Sudha

2 Replies

Avatar

Level 10

Well, the data is still base64 encoded and needs to be decoded first.

Here's an example form you can start with.

http://blogs.adobe.com/formfeed/2009/08/base64_encode_a_pdf_attachment.html

Avatar

Former Community Member

Hi radzmar,

Thanks for reply.

Still Iam unable to parse the excel file. my vFile returns "PF". Does it mean that data is base 64 encoded?

kindly help me in resolving this issue.

Regards,

Sudha