Printing Some Pages

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

Post Reply
TheHoff
Posts: 1
Joined: Wed Nov 06, 2013 12:36 pm

Printing Some Pages

Post by TheHoff »

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.

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];

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

Mark
Alex
Site Admin
Posts: 2305
Joined: Thu Jul 10, 2008 2:21 pm

Re: Printing Some Pages

Post by Alex »

Hello Mark,

Please read how to print images in WinForms in the documentation:
http://www.vintasoft.com/docs/vsimaging ... Forms.html

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

Best regards, Alexander
Post Reply