Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 880539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:06:53+00:00 2026-05-15T12:06:53+00:00

I need to print a text content, I use this code for this, but

  • 0

I need to print a text content, I use this code for this, but don’t work, the paper is empty

      PrintDocument myPrintServer = new PrintDocument();

        myPrintServer.PrinterSettings.PrinterName = @"\\servername\printerName";
        StringReader myReader = new StringReader("test string content");
        myReader.Close();

Could someone tell me what is wrong?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:06:54+00:00Added an answer on May 15, 2026 at 12:06 pm

    You must add code to render your string to the graphics context of the PrintDocument object you create. See the example on MSDN and note how they use the event handler to render text to the page:

              pd.PrintPage += new PrintPageEventHandler
                 (this.pd_PrintPage);
              pd.Print();
    

    and then:

    // The PrintPage event is raised for each page to be printed.
    private void pd_PrintPage(object sender, PrintPageEventArgs ev) 
    {
    

    …

          ev.Graphics.DrawString(line, printFont, Brushes.Black, 
             leftMargin, yPos, new StringFormat());
    

    …

    }
    

    If you want to send pre-formatted data directly to the printer from C#, you can use the RawPrinterHelper defined in this MSDN example and do things like
    string s = “Hello”; // device-dependent string, need a FormFeed?

    // Allow the user to select a printer.
    PrintDialog pd  = new PrintDialog();
    pd.PrinterSettings = new PrinterSettings();
    if( DialogResult.OK == pd.ShowDialog(this) )
    {
        // Send a printer-specific to the printer.
        RawPrinterHelper.SendStringToPrinter(pd.PrinterSettings.PrinterName, s);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 499k
  • Answers 500k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is not pretty but it works: rm -R $(ls… May 16, 2026 at 12:45 pm
  • Editorial Team
    Editorial Team added an answer Yes. Override the base1 and base2 methods in Derived to… May 16, 2026 at 12:45 pm
  • Editorial Team
    Editorial Team added an answer No, you can't. Unfortunately, UIEvent doesn't expose any public way… May 16, 2026 at 12:45 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I need a multiline TextBox which is always disabled, but it shouldn't paint itself
I have an ASP.NET web site technology that I use for scores of clients.
Say I have an XML document (represented as text, a W3C DOM, whatever), and
I have a billboard quad with a texture mapped onto it. This is basically
How should I store (and present) the text on a website intended for worldwide
I'm writing the contents of a text file to a StringBuilder and I then
I have to do an HTML page with 2 text boxes, one for name
I have some reasonable (not obfuscated) Perl source files, and I need a tokenizer,
No coffee. Brain. Not. Functioning. I have this linq query here: Public Function ListAllVisitDates()
I need a function which takes an arbitrary number of arguments (All of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.