My goal is either to detect the presence of PDF object (or) validate the PDF/stream if the PDF is displayed/failed to load.
Tried different solutions available/suggested but nothing worked. Would highly appreciate for any suggestions to achieve any of these(detect the presence of PDF object (or) validate the PDF/stream if the PDF is displayed/failed to load.)
Here is the sample code i'm using to display the PDF on my page.
In displaying JSP:
<Object id= "main_content" type="application/pdf" frameborder= "0" scrolling="auto" marginheight= "1" align="top" height = "197px" WIDTH="100%" data="sample.jsp" standby="Loading document...">Oops, you have no pdf viewer enabled.</Object>
In processing JSP:
String pdfData ="some data in base64 encoded stream"
byte[] byteArr = pdfData.getBytes();
byteArr = Base64.decodeBase64(byteArr);
response.reset();
response.setContentType("application/pdf");
response.setHeader("Content-disposition", "inline; filename=\"sample.pdf\"");
OutputStream output = response.getOutputStream();
output.write(byteArr);
output.close();