Click here to Skip to main content
15,916,462 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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--)
            Bitmap Bmp = new Bitmap(BmpFiles[FileCounter]);
            if (Bmp.Width / W < Bmp.Height / H)
                W = Bmp.Width * H / Bmp.Height;
                H = Bmp.Height * W / Bmp.Width;

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


    FileCounter -= 1;

    if (FileCounter > 0)
        e.HasMorePages = true;
        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.
Updated 6-Sep-13 23:37pm

1 solution

You have a break; statement inside your try block, which means you never get past the first item. You also have an empty catch block, which means your program will ignore all exceptions and probably fail without reason.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900