print two images on single page c#

Sep 7 2013 1:44 AM
I want to print two images on single page. I have tried below code, but it is printing all images on different pages.

public void PD_PrintPage(object sender, PrintPageEventArgs e)
    {

        float W = e.MarginBounds.Width;

        float H = e.MarginBounds.Height;

        for (; FileCounter >= 0; FileCounter--)
        {

            try
            {

                Bitmap Bmp = new Bitmap(BmpFiles[FileCounter]);

                if (Bmp.Width / W < Bmp.Height / H)

                    W = Bmp.Width * H / Bmp.Height;

                else
                    H = Bmp.Height * W / Bmp.Width;

                e.Graphics.DrawImage(Bmp, 0, 0, W, H);

                break;

            }

            catch
            {

            }

        }

        FileCounter -= 1;

        if (FileCounter > 0)
        {

            e.HasMorePages = true;

        }

        else
        {

            FileCounter = BmpFiles.Length - 1;

        }

    }

this will print all images in different page

I want some functionality that will print one image ,leave some space and again prine other image in same page if space is remaining.


Answers (2)