views:

85

answers:

1

Hello experts,

I am using the below mentioned code in my VB.net application to print two copies of pdf document.

js.Append("var pp = this.getPrintParams();")
    js.Append("var iCopies = 2;")
    js.Append("var iPages = this.numPages;")
    js.Append("pp.NumCopies = iCopies;")
    js.Append("pp.interactive = pp.constants.interactionLevel.silent;")
    js.Append("for ( var i = 0; i < iPages; i++ ) { pp.firstPage = i; pp.lastPage = i;")
    js.Append("this.print(pp);")
    js.Append("}")

It is working great. But how can I make the last page print only 1 copy instead of two copies.

Your help greatly appreciated.

A: 
js.Append("for ( var i = 0; i < iPages; i++ ) { pp.firstPage = i; pp.lastPage = i;")
js.Append("if(i == (iPages - 1)) pp.NumCopies = 1; ") ' This line does it
js.Append("this.print(pp);")
js.Append("}")
Josh Stodola
Thanks for your response Josh. But it is still printing 2 copies of last page.
acadia
I took a shot in the dark. Your pp.NumCopies must be a pretty worthless variable then. Good luck.
Josh Stodola