Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

Read excel from Acrobat Javascript

Avatar

Level 2

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

0 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

Level 2

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