UTF-8/ANSI encoded text file Conversion to Pdf

Hello there,


We are trying to convert text files to pdf using Aspose Pdf, we followed the code sample below and setting Aspose.Pdf.Generator.Pdf.SetUnicode().
Convert PDF documents using C# API|Aspose.PDF for .NET

This however fails to render ASCII characters encoded in ANSII format.

Can you advise how do we go about resolving this?




Hi,

Thanks for using our API’s.

I have tested the scenario using DOM approach of Aspose.Pdf namespace and have managed to reproduce same problem. For the sake of correction, I have logged it as PDFNEWNET-40854 in our issue tracking system. We will further look into the details of this problem and will keep you posted on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

[C#]

// Read the source text file
TextReader tr = new StreamReader(myDir + "ASCII_Test.txt");

// Instantiate a Document object by calling its empty constructor
Document doc = new Document();

// Add a new page in Pages collection of Document
Page page = doc.Pages.Add();

// Create an instance of TextFragment and pass the text from reader object to its constructor as argument
TextFragment text = new TextFragment(tr.ReadToEnd());

// Set font for the text
text.TextState.Font = FontRepository.FindFont("Arial Unicode MS");

// Add a new text paragraph in paragraphs collection and pass the TextFragment object
page.Paragraphs.Add(text);

// Save resultant PDF file
doc.Save(myDir + "TexttoPDF.pdf");

Any news here?

@dr_oli

We are afraid it has not been scheduled yet and is still pending for investigations. We will be informing here once any update will be available. We really appreciate the patience and comprehension in this regard.