Last active
March 16, 2022 14:21
How to Convert RTF to PDF using C#. For more information, please follow link: https://kb.aspose.com/words/net/how-to-convert-rtf-to-pdf-using-c-sharp/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Aspose.Words; | |
using Aspose.Words.Saving; | |
namespace WordKB | |
{ | |
public class ConvertRtfToPdfUsingCSharp | |
{ | |
public static void Main2(string[] args) | |
{ | |
Load the license to avoid trial version watermark in the converted PDF from RTF | |
License RtfToPdfLicense = new License(); | |
RtfToPdfLicense.SetLicense("Aspose.Word.lic"); | |
// Load the source input RTF file | |
Document inputRtfFile = new Document("InputSampleRtf.rtf"); | |
// Create and initialize PdfSaveOptions to customize the output PDF file | |
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions(); | |
// Set color mode for rendering the contents | |
pdfSaveOptions.ColorMode = ColorMode.Grayscale; | |
// Save the converted PDF file from RTF | |
inputRtfFile.Save("OutputRtfAsPdf.pdf", pdfSaveOptions); | |
System.Console.WriteLine("Done"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment