Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Seth Ford   on Mar 03 In Java Category.

  
Question Answered By: Sumitra 2004   on Mar 03

As specified below I am trying to open  the pdf  Document by using servile, in my
code i am setting the Mime type - application/pdf.

Here i am sending my code, Please take a look and suggest  me for the best
possibility.

public void service(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res)
throws javax.servlet.ServletException, java.io.IOException
{
HttpServletResponse hResponse = (HttpServletResponse) res; // Creating the
responce object.
String sMimetype = "application/pdf";
hResponse.setContentType(sMimetype);
hResponse.setStatus(hResponse.SC_OK);
OutputStream out = hResponse.getOutputStream();
byte[] bOutput = (byte[])agaDataDoc.getProperty("doccon"); // Reading the
document content from the database  and costing into byte array.
out.write(bOutput);
}

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Problem Opening the PDF document using the servlet Or get search suggestion and latest updates.


Tagged: