Help! I need to convert RTF to PDF using C#


Article from our customer

Hello everyone! Please tell me how to convert RTF string to PDF stream?!

Finally, our company has decided to move to modern technology of document processing. We have a variety documents in RTF format storing in the database. At the request of the visitor to choose from a database RTF document stored as RTF string and display the document to the user. We have chosen the PDF format. The principle of operation was simple and easy. At the request of the customer from the base gets out rtf and convert to a PDF stream, a physical file is not created and does not take place on the server’s hard disk! After the converting a PDF download on the client browser or by using the PDF Viewer!

We picked out a few libraries, but stopped on the component “PDF Metamorphosis. NET” that can run under any platform … Below I show the code:


            SautinSoft.PdfMetamorphosis p = new SautinSoft.PdfMetamorphosis();
byte[] pdfBytes = p.RtfToPdfConvertFileToByte(Path.Combine(Server.MapPath(""), @"Document.rtf"));

//show PDF
if (pdfBytes != null)
{
    Response.Buffer = true;
    Response.Clear();
    Response.ContentType = "application/PDF";
    Response.BinaryWrite(pdfBytes);
    Response.Flush();
    Response.End();
}
                    

Если вам нужен пример кода или у вас есть вопрос: напишите нам по адресу support@sautinsoft.ru или спросите в онлайн-чате (правый нижний угол этой страницы) или используйте форму ниже:



Вопросы и предложения всегда приветствуются!

Мы разрабатываем компоненты .Net с 2002 года. Мы знаем форматы PDF, DOCX, RTF, HTML, XLSX и Images. Если вам нужна помощь в создании, изменении или преобразовании документов в различных форматах, мы можем вам помочь. Мы напишем для вас любой пример кода абсолютно бесплатно.