We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Converting .txt to .pdf

Hi,

I have a problem with converting .txt files to .pdf using Aspose.Total (version 18) for C#.
When I convert a .tx file to PDF using Danish encoding, the size and font of the text will be changed in the PDF file.

Motor Tariff Estimation.zip (1.1 KB)

I do it by this way:

TextReader tr = new StreamReader(fileInfo.FullName, Encoding.GetEncoding(“iso-8859-1”));
var doc = new Aspose.Pdf.Document();
var page = doc.Pages.Add();
var text = new TextFragment(tr.ReadToEnd());
page.Paragraphs.Add(text);
doc.Save(memoryStream);

Do you have any idea, what I do wrong?

Thanks for your help in advance!

BR,
Akbar Azizi

@axaz,

You can set text properties, including font, color and size with TextState member of the TextFragment instance. Please refer to this help topic: Add text to PDF document

Okay, thanks!

It is apparently changed in the new version, since it worked (with the same code) better in version 2, we used earlier.

BR
Akbar Azizi

@axaz,

It is nice to hear from you that the problem has been resolved. Please let us know whenever you need any further assistance.

Hi Imran,

We expected actually everything worked like before, but it doesn´t.

Now we have discovered that after conversion, the tab information is also gone:

Original text:
Motor Tariff Estimation.zip (1.1 KB)

Converted text:
Target.zip (46.0 KB)

Text tab problem:
TextTabProblem.zip (234.9 KB)

How can we fix this problem?

BR,
Akbar Azizi

@axaz,

We managed to replicate the said issue in our environment. It has been logged under the ticket ID PDFNET-44822 in our bug tracking system. We have linked your post to this ticket and will keep you informed regarding any available updates.

Hi Imran,

Have you had time to investigate this issue?

BR,
Akbar Azizi

@axaz,

The bug logged under the ticket ID PDFNET-44822 is pending for the analysis and not resolved yet. We will investigate as per the development schedules, and notify you once it is fixed.