1.) For TXT file conversion, we have used Aspose.words for Java 21.5.
com.aspose.words.LoadOptions options = new com.aspose.words.LoadOptions();
options.setLoadFormat(com.aspose.words.LoadFormat.TEXT);
Document document = new Document(GZIPInputStream, options);
document.save(outputStream, SaveFormat.PDF);
For text file conversion with Aspose.words, we have the above issue. (For small files, aspose is not auto-detecting the encoding of file.)
2.) For CSV file, we have used Aspose.Cells for Java 21.4 since we need the grid(column and row) structure. For this, encoding is not auto-detecting for the shared files.
TxtLoadOptions options = new TxtLoadOptions(LoadFormat.CSV);
Workbook csvworkbook = new Workbook(GZIPInputStream, options);
csvworkbook.save(saveLocation + fileName, pdfopts);
If I set encoding, the files are converted correctly. But my csv files can have any different encoding. Is it possible for Aspose.cells to convert those files to PDF with out mentioning the encoding type in code.?
I am afraid, this is not possible. Please note, since CSV file format is just a text format which does not follow specific standards to evaluate specific encoding type in it. In short, you have to specify the encoding type while using load options for your needs, so you will use TxtLoadOptions class and set your desired encoding type for your CSV file accordingly.
We evaluated it already. A CSV file is just a plain text file and one can use any way and any encoding to create it. It might not be possible to give a solution to handle all kinds of template files. You may specify the encoding for your files by TxtLoadOptions.Encoding. Otherwise the used encoding completely depends on the System, just like you create a StreamReader from a Stream without specifying the encoding.
Anyways, we will further evaluate and discuss it with team internally and let you update here (once available).