Sending a textfile to the printer

Posted on 2006-04-17
Last Modified: 2010-04-16

I need to print a few lines of text, and am loking for an easy way to do this.  So I thought it would be easiest if I simply wrote wht I need to a textfile, then sent the file to the printer.

Can anyone explain an easy way to do this?

Question by:ba272
    LVL 12

    Accepted Solution

    Indeed there are lots of articles that shows you how to print a file using PrintDocument class, DrawString method of Graphics class or API functions ..
      See MSDN help for PrintDocument class, or

      But if you only want to send a file to the printer you can run a OS 'copy' command:

    System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo("copy " + filename + " prn:"));
          Instead of PRN: you can also use a port name where a printer is conected (LPT1:)

    LVL 10

    Assisted Solution


    This is for raw printing for dotmatrix
    hope it will work for you


    Author Comment

    actually, it's a thermal strip printer.  I don't think I'd know where to buy a dot matrix even if I wanted one!

    I'm sure there is value in your link though.  So thanks,


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now