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

Free Support Forum - aspose.com

Send document data to the request.getOutputStream

I hve successfully created a document and sent it to the by using this code i found in another thread…

private void sendToBrowser(Document doc, String demoName, String formatType, boolean openNewWindow, HttpServletResponse response)

throws Exception

{

String extension = formatType;

String fileName = demoName + “.” + extension;

// Add the Response header

if(openNewWindow)

response.setHeader(“content-disposition”,“attachment; filename=” + fileName);

else

response.addHeader(“content-disposition”,“inline; filename=” + fileName);

response.setContentType(“application/msword”);

doc.save(response.getOutputStream(), SaveFormat.DOC);

}


My problem is that when I send this data to the client and it asks them to save the document - I lose control of the ability to forward to the same jsp that just created the document. On the client side the old jsp’s page is in limbo. I need to ‘reload’ that page to reset all the jsp variables at the very top of the jsp.


Any ideas as to how I can forward or redirect to the current (same) jsp?



Hi John,


Thanks for your inquiry. I think, on your main page, when a user requests document, you can open a new browser instance and transfer stream to him via new browser tab. This will prevent modification to the response object of your main page. I hope, this helps.

Best regards,