Click here to Skip to main content
15,921,530 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all , i have created window application, from my application i ll print
one notepad file , so i ll assign the font for that notepad file through coding
the problem is when i assign the barcode font to the that notepad file through coding its not at all accepting
and i am getting empty output.

this is my coding here

string printPath = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                      fileToPrint = new System.IO.StreamReader(bar_path);
                      printFont = new System.Drawing.Font("AV-Web-Mal1", 10.5F);
                      string barcode_printername = File.ReadAllText("C:\\Printer Name\\barcode printername.txt");
                      printDocument1.PrinterSettings.PrinterName = barcode_printername;
Updated 24-Aug-11 23:11pm
Prerak Patel 25-Aug-11 5:08am    
Not clear. Share more code.

You don't want to use Notepad to print for you., You want to print from within your own code. Here's a CodeProject article on the topic:

Simplified .NET Printing in C#[^]

If that doesn't satisfy you, I got 229,000 reuslts back when I googled "c# print a text file codeproject".
Share this answer
You have to explain explicitly if you are calling the system notepad from your application or you design an application that looks like notepad

If you are calling the windows notepad in your application like. You cannot change the font from your code. you will have to open the notepad and change the font manually from the (Format >> Font) Menu

Explicitly means clearly what you really want to do?
Share this answer
sameertm 25-Aug-11 5:18am    
may i know what u mean by explicity..

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