Conversion of text to pdf is failing

Hi,
I am trying to convert a text file to PDF using Aspose.words,. I see the below exception and it is failing in conversion. Can you please assist?
Note:
Giving a direct file path for conversion works whereas giving inputstream fails.
Code:

Document doc = new Document(is); // "is" is inputstream
com.aspose.words.PageSetup ps1 = doc.getFirstSection().getPageSetup();
ps1.setLeftMargin(0.36 * 72); // 0.5 inch
ps1.setRightMargin(0.36 * 72);
doc.save("C:/temp/ImagetoPDF.pdf")

Exception:

java.lang.Exception: com.aspose.words.UnsupportedFileFormatException: Pdf format is not supported on this platform. Use .NET Standard or .NET 4.6.1 version of Aspose.Words for loading Pdf documents.

doc1.txt.zip (381 Bytes)

@Tejapriya It looks like you are trying to load PDF document. Please make sure your input stream does not contain PDF document.
I have tested with the following code and your TXT document and everything works file:

FileInputStream is = new FileInputStream("C:\\Temp\\in.txt");
Document doc = new Document(is); // "is" is inputstream
com.aspose.words.PageSetup ps1 = doc.getFirstSection().getPageSetup();
ps1.setLeftMargin(0.36 * 72); // 0.5 inch
ps1.setRightMargin(0.36 * 72);
doc.save("C:/temp/out.pdf");