Convert input stream to PDF in Java

Hi Team,

I want to convert input stream to pdf file and also wants to download that converted pdf file in java. Please help to provide code spinet so that we can use it in my project.

Many thanks

1 Like

@saras1234,

Below is the sample code:

 try {
        Converter converter = new Converter(new FileInputStream(sourcefile));
        PdfConvertOptions options = new PdfConvertOptions();
        converter.convert(convertedFile, options);
    } catch (Exception e) {
        throw new GroupDocsConversionException(e.getMessage());
    }

You can download API here.

Please note that API doesn’t provide any such feature. It just generates the output file in a specified folder. However, you can implement your own logic to download file.