• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 973
  • Last Modified:

C# Richtextbox Print

Hi. I have to do a change in some old C# code.. it´s a big program so I can´t just redo the whole program.

Today they have LPT-port printers...  Step 1 is to change this to thernet new printers..
But my first task is this.

The program collect some data into a Richtextbox. Then it writes this out to a printer..
.I can´t understand that it should be this hard to do a print from a Richtext box..
I have google for a big time now but can´t figure this out..

Can someone give me som tips...
Can I do something like this

richtextbox.print() ore something...
  • 2
  • 2
2 Solutions
Ivo StoykovCommented:
Look here


Ivo Stoykov
kavvisAuthor Commented:
thank you for your replay...

I´m pretty new att C# so I got some problems to include this...

On a button click I do this..

 PrinterSettings settings = new PrinterSettings();
     prtxt = RptText.Text;

//and then I try to include this part..

        // Print RichTextBox content
        private void PrintCommand()
            PrintDialog pd = new PrintDialog();
            if ((pd.ShowDialog() == true))
                //use either one of the below      
                pd.PrintVisual(richTB as Visual, "printing as visual");
                pd.PrintDocument((((IDocumentPaginatorSource)richTB.Document).DocumentPaginator), "printing as paginator");

But I cant figure this out :(
Ivo StoykovCommented:
what's the problem?
kavvisAuthor Commented:
I will get back to you with new info asoon as I can...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now