Page 1 of 1

Printing Some Pages

Posted: Wed Nov 06, 2013 1:08 pm
by TheHoff

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;
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. :?: :?:

Code: Select all

        void ipd_PrintImage(object sender, PrintImageEventArgs e)
            if (currentPage < ic.Count)
                e.Image = ic[currentPage];

                if (currentPage >= ic.Count)
                    e.HasMoreImages = false;
                    currentPage = 0;
                    e.HasMoreImages = true;
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 :)


Re: Printing Some Pages

Posted: Wed Nov 06, 2013 8:14 pm
by Alex
Hello Mark,

Please read how to print images in WinForms in the documentation: ... Forms.html

and let me know if you will have any question or problem.

Best regards, Alexander