I'm trying the code I did but I'm having a problem regarding PageContext. I have added the EMBED code in my JSP. Now I have a function in my servlet where I get the PageContext:
public void setContext(PageContext pageContext)
{
this.pagecontext = pageContext;
context = pagecontext.getServletContext();
res = (ResourceBundle) context.getAttribute("timecard.form.GlossaryBundle");
}
My previous JSP code is like this:
PDFServlet createPDF = new PDFServlet();
createPDF.setContext(pageContext);
createPDF.doGet(request, response);
Now with the EMBED code, my code is something like this:
PDFServlet createPDF = new PDFServlet();
createPDF.setContext(pageContext);
String[] keyvals = request.getParameterValues("itemdate");
String user = request.getHeader("User-Agent");
if(user.indexOf("MSIE") != -1 &&
user.indexOf("Windows") != -1){
out.print("<body leftMargin=\"0\" topMargin=\"0\" scroll=\"no\">");
out.print("<EMBED src=""
+ keyvals
+ "\" width=\"100%\" height=\"100%\" fullscreen=\"yes\" type=\"application/pdf\">");
}
else{
response.sendRedirect("/timecard/servlet/pdfservlet.pdf?itemdate=" + keyvals);
}
The first and second line obviously don't work. I don't know how I can pass the PageContext to my servlet now. Please help. :(
Thank you.
---------- Forwarded message ----------
From: bruno <[EMAIL PROTECTED]>
Date: Mar 28, 2006 6:59 PM
Subject: Re: Fwd: [iText-questions] Opening PDF Servlet in New Window
To: Hevn <
[EMAIL PROTECTED]>
Cc: [email protected]
Hevn wrote:
> What happens now is that it opens the new window but it is blank and
> then it opens the Adobe Reader.
Indeed, I see that quite often when I download documents
from the net (even with FireFox). It's not very elegant, but
I can live with it.
> I will try to study the links you've given me and try to work my way
> around with it. Thank you.
OK,
br,
Bruno
- Re: [iText-questions] Opening PDF Servlet in New Window Hevn
