Hola!
Para ver cómo insertar código lee las instrucciones en
https://www.aprenderaprogramar.com/foros/index.php?topic=1460.0También es importante que indiques en qué lenguaje estás trabajando (e incluso la versión), qué bibliotecas estás usando, etc.
He visto este ejemplo para trasladar el contenido de un richtextbox a un pdf usando la biblioteca iTextSharp
// step 1: creation of a document-object
iTextSharp.text.Document myDocument = new iTextSharp.text.Document(PageSize.A4.Rotate());
try
{
// step 2:
// Now create a writer that listens to this doucment and writes the document to desired Stream.
PdfWriter.GetInstance(myDocument, new FileStream(sfd.FileName, FileMode.Create));
// step 3: Open the document now using
myDocument.Open();
// step 4: Now add some contents to the document
myDocument.Add(new iTextSharp.text.Paragraph(richTextBox1.Text));
}
catch (DocumentException de)
{
Console.Error.WriteLine(de.Message);
}
catch (IOException ioe)
{
Console.Error.WriteLine(ioe.Message);
}
// step 5: Remember to close the documnet
myDocument.Close();
Pero no estoy seguro de que esto te vaya a exportar los estilos desde el richTextBox al pdf (por ejemplo la alineación justificada). Como opción alternativa está convertir el código rtf del RichTextBox a HTML, y luego usar XMLWorkerHelper para generar el pdf. En ese caso hacen falta las dll:
itextsharp.dll
itextsharp.xmlworker.dll
Saludos!