How can i send Printdocument to richtextbox so i can write something above text and send it as email.

here is code:

private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                PrintDocument pd = new PrintDocument();
                pd.PrintPage += new PrintPageEventHandler(this.PrintPageEventHandler);
               
                if (this.storedPageSettings != null)
                    pd.DefaultPageSettings = this.storedPageSettings;
                PrintPreviewDialog dlg = new PrintPreviewDialog();
                
                dlg.Document = pd;
                dlg.Width=800;
                dlg.Height = 800;

                dlg.ShowDialog();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

any help is appreciated

Use, instead "Window.Print()" Method. Hope it helps u. Sorry, it will work only for the Web Application. And if ur application is an web app then use it in onclick event of any button. It will work.

Edited 5 Years Ago by akshintlakalyan: n/a

Use, instead "Window.Print()" Method. Hope it helps u. Sorry, it will work only for the Web Application. And if ur application is an web app then use it in onclick event of any button. It will work.

I am using windows application. Problem is that I don't know if that is really a convertable type..you know from printdocument to string or stringbuilder

So I would really need help...That is the last thing in my project to do.

This article has been dead for over six months. Start a new discussion instead.