Printing Some Pages
Posted: Wed Nov 06, 2013 1:08 pm
Hi
When I call the ImagePrintDocumet.Print() method it always prints all pages even when I set the "from" and "to" in the print dialogue and set PrinterSettings.PrintRange = PrintRange.SomePages
I've also tried setting manually setting "from" and "to" in printer settings.
My code is based on the sample code, which I must say seems bizarre. You call the .Print() method which seems to then fire an event once for each page in the image. The event uses a page count to track which page to print.
I'm sure I could find a way round this by splitting the image up into single page images and printing the ones I want BUT the fact that you can set this property (PrinterSettings.PrintRange = PrintRange.SomePages) would suggest that this approach is not necessary.
Any help gratefully accepted
Mark
When I call the ImagePrintDocumet.Print() method it always prints all pages even when I set the "from" and "to" in the print dialogue and set PrinterSettings.PrintRange = PrintRange.SomePages
I've also tried setting manually setting "from" and "to" in printer settings.
Code: Select all
ipd.PrinterSettings.FromPage = 2;
ipd.PrinterSettings.ToPage = 2;
Code: Select all
void ipd_PrintImage(object sender, PrintImageEventArgs e)
{
if (currentPage < ic.Count)
{
e.Image = ic[currentPage];
currentPage++;
if (currentPage >= ic.Count)
{
e.HasMoreImages = false;
currentPage = 0;
}
else
{
e.HasMoreImages = true;
}
}
}
Any help gratefully accepted
Mark