These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

getPageBox() and jscript error

joey
Registered: Jun 5 2008
Posts: 2

i'm using windows scripting host and jscript (not vbscript). i cannot read anything returned by getPageBox(). the array is always empty. in fact, i seem to have problems with all methods that return arrays, so solving this coding error should clear up my other problems as well. here's part of my code.

var avdoc = WScript.CreateObject("AcroExch.AVDoc");
avdoc.Open("c:\\temp\\a.pdf", "temp");
var ppdDoc = avdoc.GetPDDoc();
var oJS = ppdDoc.GetJSObject();
WScript.Echo(oJS.info.Title); //no problem here
var a = new Array(4);
a = oJS.getPageBox("Media"); //"Art", "Crop","Trim", etc all fail as well
WScript.Echo(a[0]); // no error produced, but no output
WScript.Echo(oJS.getPageBox("Media")[0]); //second try, and still no output

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
I don't know if the IAC methods will work the same with JScript and the WSH as with VB. There may be some fundamental incompatability with the container data types.

You might also consider including the page number in the call to "getPageBox". I know the JS reference says it's optional, but you're calling across domains and you never know how it'll handle a missing parameter. WSH might be setting it to somthing like 0xFFFF instead of null or zero.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script