Q:

Is it possible to print on both sides, like printing ID card or driving license, in c#?

I have two images front.jpg and back.jpg. I want to print them front and back on a same page to make one 'card'. I came across 'duplex' property but not sure how it can help me in this regard.
I tried using Duplex. I am trying to print two images in printDocument1_PrintPage event for front and back 
private void button1_Click(object sender, EventArgs e)
{
    PrintDocument pd = new PrintDocument();
    pd.PrintPage += printDocument1_PrintPage;
    //here to select the printer attached to user PC
    PrintDialog printDialog1 = new PrintDialog();
    printDialog1.Document = pd;
    DialogResult result = printDialog1.ShowDialog();
    pd.PrinterSettings.Duplex = Duplex.Horizontal;

    if (result == DialogResult.OK)
    {    
        pd.Print();//this will trigger the Print Event handeler PrintPage
    }
}

private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
{
    try
    {
        #region Front
        //Load the image from the file
        System.Drawing.Image img = System.Drawing.Image.FromFile(@"E:\front.jpg");

         //Adjust the size of the image to the page to print the full image without loosing any part of it
         Rectangle m = e.MarginBounds;

         if ((double)img.Width / (double)img.Height > (double)m.Width / (double)m.Height) // image is wider
         {
              m.Height = (int)((double)img.Height / (double)img.Width * (double)m.Width);
         }
         else
         {
             m.Width = (int)((double)img.Width / (double)img.Height * (double)m.Height);
         }
         e.Graphics.DrawImage(img, m);
         #endregion

         //Load the image from the file
         System.Drawing.Image img1 = System.Drawing.Image.FromFile(@"E:\back.jpg");

         //Adjust the size of the image to the page to print the full image without loosing any part of it
         Rectangle m1 = e.MarginBounds;

         if ((double)img1.Width / (double)img1.Height > (double)m.Width / (double)m.Height) // image is wider
         {
                m.Height = (int)((double)img1.Height / (double)img1.Width * (double)m.Width);
         }
         else
         {
             m.Width = (int)((double)img1.Width / (double)img1.Height * (double)m.Height);
         }
         e.Graphics.DrawImage(img1, m1);

        }
        catch (Exception)
        {

        }
    }

A:

I believe that your problem is that you aren't printing one two sided page, you are printing two pages, one on each side of a piece of paper.  The duplex magic happens in the printer/driver, not GDI.
I only see one page getting printed here.
Don't try to print both images in one pass.

Do the work to print the first image.
Set (PrintPageEventArgs) e.HasMorePages = true;
Return from this function and you will get called again for the second page.
Now, print the second image and set e.HasMorePages = false;

That should work.
Good luck!

