However, it converts the current date time string as bytes before writing to techcoil.txt.įileInfo fileInfo = new FileInfo("techcoil.txt") įileStream fileStream = fileInfo.Open(FileMode. To print such files in Windows, the user shall right-click the file and selecting Microsoft Office Document Imaging. The idea is that later you might want to send this file. As with the previous example, the following code writes the current date time string to the end of techcoil.txt. When you print to a file the program outputs whatever it would have sent to the printer you have attached to your computer to a file instead. To write binary data to file, we can use the Write method of the FileStream instance. Write the current date time to the fileįileWriter.WriteLine(())
StreamWriter fileWriter = new StreamWriter(fileStream) Encapsulate the filestream object in a StreamWriter instance. It's main file type association is the HP PCL Printer Output format, but also.
#HOW TO PRINT .PRN FILE USING C# SOFTWARE#
p.StartInfo.FileName 'G:\\tst. Most PRN files can be viewed with eight known software applications, typically Canvas X developed by ACD Systems. If techcoil.txt exists, seek to the end of the file,įileStream fileStream = File.Open("techcoil.txt", You need to escape the \ in your filename string.