If it prints all the pages, that's because that is what you told it to do: the
PrintDocument.PrintPage Event (System.Drawing.Printing) | Microsoft Docs[
^] gets called repeatedly until it sets the
PrintPageEventArgs.HasMorePages
to
false
.
The system has no idea what you do or don't want to print: it relies on you to decide that and set HasMorePages to false when you are done.
So if you want to print less info you need to change the PrintPage event handler code - which we can't see - to restrict it to "just the pages" you need it to.
Sorry, but we can't do that for you!