Using Aspose Words to convert TXT to PDF actually modifies my document

I am using Aspose words to load a TXT document and save it as a PDF document. I’ve tried both version 14.6.0.0 and 13.8.0.0. My code is very simple:

var stream = {load TXT document}
var document = new Aspose.Words.Document(stream);
document.Save("Somepath.pdf");

However, the document is being modified by this code. It appears to me that Aspose is trying to auto-number the lines or something like that, when it shouldn’t be touching the content at all. The original document is:

  1. A
  2. B
  3. C
  4. D
  5. E
  6. F
  7. G
  8. H 3. I
  9. J
  10. K

And the PDF document that Aspose converts it to is:

  1. A
  2. B
  3. C
  4. D
  5. E
  6. F
  7. G
  8. H 3. I
  9. J
  10. K

Notice the last two lines. It changes the “4. J” into “5. J” and changes “4. K” into “6. K”.

Is this fixed in a newer version? Are there some settings I can set that make Aspose so that it absolutely will not attempt to change any of the content of the TXT file?

Hi Joshua,

Thanks for your inquiry.

I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-10456. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Is there a workaround I can use for now?

Hi Joshua,

Thanks for your inquiry. Please try the following workaround at your end. Hope this helps you.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write(File.ReadAllText(MyDir + "in.txt"));
doc.Save(MyDir + "Out.pdf");

The issues you have found earlier (filed as WORDSNET-10456) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.