Hi Support,
Im trying to convert the rtf content to pdf format. Im using your latest Aspose.words version 18.8.
Below is the code I used for conversion.
Please find the attached rtf content file (rtf_content12.rtf) and output pdf (Notes-RTF-060920181727.pdf).
public bool ConvertNotesRTFtoPDF()Notes-RTF-060920181727.pdf (73.3 KB)
{
// Get the Application Path & Add the RTF Content File Name
string appPath = System.IO.Directory.GetCurrentDirectory().Replace("\\bin\\Debug", "");
string rtfBodypath = appPath + @"\HTML\RTF_content12.rtf";
// Name the Output File
string fileName = appPath + @"\Output\" + "Notes-RTF-" + DateTime.Now.ToString("ddMMyyyyHHmm") + ".pdf";
// Read the RTF Contents
string rtfString = ReadFromFile(rtfBodypath);
// Convert to byteArray
MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(rtfString));
byte[] bytesOfHtmlString = stream.ToArray();
using (MemoryStream memStream = new MemoryStream())
{
// Write the Body of HTML to PDF
memStream.Write(bytesOfHtmlString, 0, bytesOfHtmlString.Length);
memStream.Position = 0;
//Aspose.Words.RtfLoadOptions loadOptions = new Aspose.Words.RtfLoadOptions();
//loadOptions.RecognizeUtf8Text = true;
Aspose.Words.Document doc = new Aspose.Words.Document(memStream);
doc.Save(fileName);
}
return true;
}<a class="attachment" href="/uploads/default/18492">rtf_content12.zip</a> (74.0 KB)