Previous Thread
Next Thread
Print Thread
Hop To
javascript to count no of pages #545806 11/30/10 06:29 PM
Joined: Nov 2010
Posts: 2
L
lepton_82 Offline OP
OP Offline
L
Joined: Nov 2010
Posts: 2

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")
{
console.show();
console.clear();
global.PageCnt = 0;
}
global.PageCnt += this.numPages;
console.println("The file " + this.path + " has "
+ this.numPages);
console.println("Total so far = " + global.PageCnt);

Re: javascript to count no of pages [Re: lepton_82] #549965 01/25/11 08:14 PM
Joined: Jan 2011
Posts: 24
K
khicke Offline
Offline
K
Joined: Jan 2011
Posts: 24
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
xls.Workbooks.Add
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
}
}


Moderated by  Acumowchek, MacGizmo, Reboot