Send 'Number of copies' to a printer

.NET programming topics
Post Reply
User avatar
Trebor29
Lieutenant
Lieutenant
Posts: 75
Joined: Thu Apr 29, 2010 12:34 am

Send 'Number of copies' to a printer

Post by Trebor29 » Thu Oct 18, 2012 6:33 pm

Hi all,

I am building an windows form application that selects a relevant ID card design and then send that to the card printer.

I can print one card, or even multiple if choosing a specific Number of Copies in the printer printDialogBox, but how can I send a specific number of copies from my application? I get the total number required from a table in sql db, but now want to send this number as the Number of copies' to the printer, so the user does not have to in the printDialog1!

I'm using Visual Studio 2010 C#.

I have been searching but cannot find anything specific. There is a .Copies property which looks promising but I haven't worked out how to implement this into my existing code yet.

Code: Select all

private void PrintDesign()
        {
            // Sends job to printer
            System.Drawing.Printing.PrintDocument pd = new System.Drawing.Printing.PrintDocument();
            pd.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printCard);

            printDialog1.AllowSelection = true;

            // ToDo: QUANTITY !!!

            if (printDialog1.ShowDialog() == DialogResult.OK)
            {
                pd.Print();
            }
        }

        private void printCard(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            e.Graphics.DrawImage(designImg, 0, 0);
        }
Thanks Guys :clap:
User avatar
Trebor29
Lieutenant
Lieutenant
Posts: 75
Joined: Thu Apr 29, 2010 12:34 am

Re: Send 'Number of copies' to a printer

Post by Trebor29 » Fri Oct 19, 2012 2:06 pm

Hello people..

this seems to be working for me;

Code: Select all

pd.PrinterSettings.Copies = Convert.ToInt16(dialogBox.NewCardQuantity);
But now having trouble rendering the image to fit onto the ID cards!

:roll:
Post Reply

Return to “.NET Programming”