OscarAkaElvis
OscarAkaElvis

Reputation: 5714

TypeError: this.ExportDataObject is not a function

I have a simple pdf file containing an embedded file (test.xml) I'm trying to add a JS to call it once the pdf file is opened (even with notification to user to accept the risk etc). I've read that to perform that, the JS that should be used is this:

this.ExportDataObject({cName:"test.xml", nLaunch:2});

For some reason, it is not working. I checked the debug js console on my Acrobat reader DC (version 2021.001.20145) the the error shown is TypeError: this.ExportDataObject is not a function. I'm not sure why on my "this" object the ExportDataObject is not available... I think it should be available always, shouldn't it? I also tested without the this. and the error is different ReferenceError: ExportDataObject is not defined.

That makes to think to me that this.ExportDataObject is existing but is not a function as the original error said... but, if is not a function, what is? a typeof is showing "undefined". Not sure how to make this work. Not sure if next steps should more JS debugging or if the problem is related to something on pdfs or Acrobat. Any help? thanks.

Upvotes: 2

Views: 1072

Answers (3)

Arun Kumar
Arun Kumar

Reputation: 355

As like most of the languages, js is also case sensitive.

But ReferenceError: ExportDataObject is not defined, ReferenceError always states that the object is not defined at all, and could'nt be found among the class methods.

so you need to make sure the function with the exact exportDataObject name is present and use them accordingly.

Upvotes: 1

MRPie
MRPie

Reputation: 295

I believe you misspelled ExportDataObject()

It should be exportDataObject()

Using Javascript you should be careful as it is easy to mess up spelling as JS will interpret that in different ways.

Upvotes: 1

RBarryYoung
RBarryYoung

Reputation: 56725

Javascript function names are case-sensitive and as documented by Adobe (p. 151), the correct spelling is exportDataObject() without the leading capitalization.

Upvotes: 8

Related Questions