javascript to count no of pages

Posted by: lepton_82

javascript to count no of pages - 11/30/10 06:29 PM

I am using the below javascript to count the no of pages in a PDF document/documents in a particular location(folder). I get the output in the console window but i would like to get the output in an excel sheet. Since I handle many number of PDF files, i would like to get the o/p in an excel sheet so that i can use it for reports.

if ( typeof global.PageCnt == "undefined")
global.PageCnt = 0;
global.PageCnt += this.numPages;
console.println("The file " + this.path + " has "
+ this.numPages);
console.println("Total so far = " + global.PageCnt);
Posted by: khicke

Re: javascript to count no of pages - 01/25/11 08:14 PM

I would try exporting it to an excel. such as something like this

function CreateExcelSheet()

var x=myTable.rows

var xls = new ActiveXObject("Excel.Application")
xls.visible = true
for (i = 0; i < x.length; i++)
var y = x[i].cells

for (j = 0; j < y.length; j++)
xls.Cells( i+1, j+1).Value = y[j].innerText