Free Support Forum -

Unable to release the file, after conversion into PDF using Java

API: Java - Groupdocs conversion - 19.12 version
Problem Statement: To Convert a text file into pdf and use this pdf in other process.

Once the file is converted, it is unable to release to use into other process(and shows 0 kb). But once the whole process complete i can find the the converted pdf is of some KB(i.e 20kb).

Here, is my code for TXT to pdf conversion:

public static String convertToPdfAsFilePath(String fileName) {

ConvertedDocument convertedDocumentPath = null ;
String filePathOut = new File(Paths. get (fileName).getParent().toString(), new Random().nextInt(9999) + “_” + fileName.substring(fileName.lastIndexOf(’\’)+1, fileName.length())).getPath();
filePathOut = filePathOut.substring(0, filePathOut.lastIndexOf(".")+1);
try {
ConversionHandler conversionHandler = new ConversionHandler(GroupdocsUtils. getConfiguration ());
PdfSaveOptions saveOption = new PdfSaveOptions();
String guid = fileName;
convertedDocumentPath = conversionHandler. convert(guid, saveOption);
filePathOut = filePathOut + convertedDocumentPath.getFileType();;///fileName.substring(0, fileName.lastIndexOf(".")) + “.” + convertedDocumentPath.getFileType());

} catch (Exception e) {


finally {

if (convertedDocumentPath!= null ) {

return filePathOut;


1 Like


We are investigating this. Your inestigation ticket ID is CONVERSIONJAVA-890. As there is any further update, you’ll be notified.


Your reported issue CONVERSIONJAVA-890 is now fixed in API version 20.2.1.