Free Support Forum - aspose.com

Bug found on Conversion of multiline text document into pdf

Hi,

I observed the following bug in the Aspose.Words component.

When I save a multiple line text document opened in Aspose.Words into pdf file.

The multiple line content is converted to a single line content in the converted out put file.

Note: The input txt file and out put pdf files are attached.

Kindly us know when we will have a fix for this bug.


Regards,

Robert

Hi Robert,


Thanks for your inquiry. Aspose.Words does not directly support loading text files through the use of the Document constructor. This feature is however planned. Please read supported features of plain text (txt) import/export from here:
http://www.aspose.com/docs/display/wordsnet/Load+in+the+Plain+Text+Format
http://www.aspose.com/docs/display/wordsnet/Save+in+the+Plain+Text+Format


However, you can use following code snippet to achieve your requirements. Please let us know if you have any more queries.


// Read whole txt file into string.<o:p></o:p>

string txt = File.ReadAllText(“in.txt”);<o:p></o:p>

// Insert string into document.<o:p></o:p>

DocumentBuilder builder = new DocumentBuilder();<o:p></o:p>

builder.Write(txt);<o:p></o:p>

// Save output.<o:p></o:p>

builder.Document.Save(“out.pdf”);