Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
C#
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {


                SaveAsBitmap(pagina);
                e.Graphics.DrawImage(bmp1, xST, ySUS);
                if (pagina < 6)
                {
                    pagina++;
                    e.HasMorePages = true;

                }
                else
                    e.HasMorePages = false;




        }

Ok..So I have a PrintPreviewDialog and what I try to do is display and print multiple pages each containing the image in bmp1 (Bitmap). The problem is that even if all the pages are displayed correctly inside my printPreviewDialog, when clicking the Print button in the top left corner, only the last page is printing. Any ideas? It's driving me crazy. Thanks.

P.S. The SaveAsBitmap method calls the drawToBitmap method of a given control (the control to be printed is given by SaveAsBitmap's parameter).
Posted
Updated 29-Apr-10 1:25am
v2

read this article
[]Word Processor Based Upon an Extended RichTextBox Control[^]

first take extendedrichtextbox form the project and dll file too
and then you can solve any problem in printing

good luck
 
Share this answer
 
v2
Its really easy.. When you execute the print for the PrintPreview it runs the method, but it will still contain the object in memory.

Therefore your problem is not resetting it when the first print was done.

Change to this:

C#
if (pagina < 6)
{
     pagina++;
     e.HasMorePages = true;

}
else
{
     pagina = 0;
     e.HasMorePages = false;
}
 
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