Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The problem is that, using the method, you cannot save the content of a RichTextBox in the PDF format.</p> <p>Here you can find the currently available stream format types the can be used: <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextboxstreamtype.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.windows.forms.richtextboxstreamtype.aspx</a>.</p> <p>As you see, the main supported type is RTF (Rich Text Format), a plain-text multi-platform format: this is very different from PDF. Look <a href="http://it.wikipedia.org/wiki/Rich_Text_Format" rel="nofollow">here</a> and <a href="http://it.wikipedia.org/wiki/Portable_Document_Format" rel="nofollow">here</a>.</p> <p><strong>EDIT:</strong> I just answer to the questioneer's comment asking for some helping code:</p> <pre><code>// This method opens a dialog and save the content of the passed RichTextBox private bool ShowRichTextBoxSaveDialog(RichTextBox richTextBox) { SaveFileDialog newFileDialog = new SaveFileDialog(); newFileDialog.Filter = "PDF Files|*.pdf"; newFileDialog.Title = "Save As..."; newFileDialog.Filter = "*.pdf"; // If the user confirm the dialog window... if (newFileDialog.ShowDialog() == DialogResult.OK) { try { richTextBox.SaveFile(newFileDialog.FileName, RichTextBoxStreamType.PlainText); // Success! return true; } catch(Exception e) { // Error during saving! MessageBox.Show(String.Concat("Error during saving: ", e.Message)); return false; } } else // Aborted by the user! return false; } private void button3_Click(object sender, EventArgs e) { // NEXT WILL SHOW UP 4 DIALOGS, FOR ASKING THE USER 4 FILES TO SAVE! this.ShowRichTextBoxSaveDialog(richTextBox1); this.ShowRichTextBoxSaveDialog(richTextBox3); this.ShowRichTextBoxSaveDialog(richTextBox4); // HERE I ALSO CHECK IF THE SAVING IS SUCCESSFUL.. if (this.ShowRichTextBoxSaveDialog(richTextBox5)) MessageBox.Show("Success in saving :)"); else MessageBox.Show("Failure in saving :("); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload