We have some code that converts a simple text file to a PDF file using Aspose.Words 6.1.0.0.
This works well, but on our test document (1MB of text) this takes several minutes (02:30) to complete.
Adding the lines to the document is blazing fast (milliseconds), the command that is taking up all the time is doc.Save(pdfStream, SaveFormat.Pdf);
THe logic we use to convert text to a Document is as follows:
private Document ConvertTextToWord(Stream textStream)
{
// This object will help us generate the document.
DocumentBuilder builder = new DocumentBuilder();
// Use a StreamReader to read the text document.
using (StreamReader reader = new StreamReader(textStream, Encoding.Default, true))
{
// Read plain text "lines" and convert them into paragraphs in the document.
while (true)
{
string line = reader.ReadLine();
if (line != null)
{
builder.Writeln(line);
}
else
{
break;
}
}
}
return builder.Document;
}
Source and converted files have been attached.