We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF to input stream conversion


I want to load and convert a PDF document to InputStream. How can I achieve this ?

Prabhaker Kr

Hi Prabhaker,

Thanks for your inquiry. Please check following sample code for the purpose, it will help you to convert PDF document to InputStream using Aspose.Pdf for Java.

ByteArrayOutputStream output = new

// open the source PDF document

com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(myDir+ "input.pdf");


InputStream inputStream=new ByteArrayInputStream(output.toByteArray());



Please feel free to contact us for any further assistance.

Best Regards,