Reputation: 219
I am working in C# Windows application, i am writing some content to notepad, print.txt which is located at start up position. after writing i am sending it to printer using following code
PrintDialog pd = new PrintDialog();
RawPrinterHelper.SendFileToPrinter(
pd.PrinterSettings.PrinterName,
Application.StartupPath + "\\print.txt");
But when doing so i am not able to get malayalam font in print. But malayalam getting in the note pad file and even when printing directly from note pad. Anyone can suggest a solution Thanks in advance
Upvotes: 0
Views: 1358
Reputation: 125728
Text files (.txt
) created with Notepad don't contain any font information. Notepad displays your text using the font you select, but the file itself doesn't contain fonts or any other formatting (bold, italic, and so forth).
You can remove Notepad from the equation, and use a RichTextBox
instead; that file format allows embedded fonts and other information (such as tables and images). You can then send that file to the printer, and let the default .rtf
application (WordPad or Word) to handle printing instead.
If you want to print in a specific font without using an external application, you need to either send the proper codes to your printer to set the printer's internal font, or use software that sends that information instead (like Word or PDF).
Setting your printer's internal font is vendor specific, and you'd need to check the documentation for your printer brand and model, which should be available from the printer's manufacturer.
Upvotes: 1
Reputation: 108
Can you print other language like Bangla or Hindi using your code? If not then probably your C# development environment isn't utf-8 enabled.
Upvotes: 0
Reputation: 6536
Make sure your text is encoded in Unicode, and why on earth are you even using notepad? ANY other text-editing program on the planet would do a better job.
Upvotes: 1