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

We are  got it from one of our clients...

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.ContentType = "application/PDF";
Facebook Comments

Leave a Comment

Your email address will not be published.