Free Support Forum - aspose.com

PDF to input stream conversion

Hi


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


Regards,
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
ByteArrayOutputStream();<o:p></o:p>

// open the source PDF document

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

pdfDocument.save(output);

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

....

....


Please feel free to contact us for any further assistance.

Best Regards,