How to Convert RTF to PDF in C#, VB.NET

RTF to PDF conversion is not an easily task even with the help of a 3rd party assembly, as most of them don't support directly loading file with .rtf entension. However you can effortlessly convert RTF to PDF in your application within this section, as there are only three lines of code used.

Spire.Doc for .NET is a .NET Word component, enables you to directly load file with .rtf entension and then convert RTF to PDF in C#, VB.NET. The target PDF is as clear as the original RTF file. Below is an  effective screenshot of the target PDF, please see.


Feel free to downlaod Spire.Doc for .NET to convert RTF to PDF in C# and VB.NET or try other function of Spire.doc

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spire.Doc;
namespace RTF2Pdf
	    class Program
	        static void Main(string[] args)
	            Document doc = new Document();
	            doc.LoadFromFile("sample.rtf", FileFormat.Rtf);
	            doc.SaveToFile("test.pdf", FileFormat.PDF);
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports Spire.Doc

Namespace RTF2Pdf
    Class Program
        Private Shared Sub Main(ByVal args() As String)
            Dim doc As Document = New Document
            doc.LoadFromFile("sample.rtf", FileFormat.Rtf)
            doc.SaveToFile("test.pdf", FileFormat.PDF)
        End Sub
    End Class
End Namespace

Except converting RTF to PDF, Spire.Doc also can convert Word to PDF, Word to Text, Word to HTML, Word to XML, Word to RTF, Word to Tiff with C#, VB.NET. Furthermore, Spire.Doc supports to convert HTML to Word, HTML to Image, RTF to HTML etc. Finally, Spire.Doc enables users to read, write and manipulate your word document without Microsoft Office Word Automation.