![]() The solution is simple, install Adobe Acrobat and just have it open the RTF file using the Process class. You can assign any rtf using Rtb.rtf method.Īctually, none of these are terribly reliable or do what I want. The control defines it's own page length method replacing the one used above in the code snippet and still uses PrintDocument so it should be easy to use. This article with demo code uses the RichTextBox as a starting point and by using P/Invoke leverages the power of Win32 to print RTF as WYSIWG. PrintDocument supports from and to page printing.ĭoPdf will pops up a fileSaveAsDialog box automatically so the files can be saved as a pdf document.Ī Microsoft format not supported very well so it would seem. Handling multiple pages is taken care of in this method : this.pd_PrintPage as per the msdn sample. There may be a printer enumeration method which would be more elegant and robust and against this one could test to see if the print driver existed perhaps against a config file setting. pd.PrinterSettings.PrinterName = "doPDF v6" ![]() The only part of the code I needed to add was that marked above e.g. Pd.PrintPage += new PrintPageEventHandler ![]() StreamToPrint = new = new Font("Arial", 10) To use it in say winforms code I adapted the code found on the msdn printing example private void button1_Click(object sender, EventArgs e) It just appears as another printer within Print Manager once installed. ![]() This will convert more or less any file type to a pdf format not just rtf. You could use the virtual print Driver doPdf if this is permitted on the production machine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |