Printing all pages from C++ (PDFPrint sample)

Q:

We would like to use PDFNet in a server side installment for printing
pdf documents .

We are using PDFNet SDK for VC++ 6 and we ran the PDFPrint sample. The
problem is that if the pdf has multiple pages then only the last page
prints!
-----
A:

To print every page in the document you only need to move calls to
StartPage, EndPage in the page loop:

You can obtain the updated C++ sample code using the following link:
  http://www.pdftron.com/net/samplecode/PDFPrint.cpp