This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hello Ranchers.. I'm doing a project in JSP and Oracle.. Here in my project there are two types of department.. Accounts and Sales.. Accounts department is able to download some pages to Excel format and it is working properly..
now in the sales they have to download in pdf format.. then only it is possible to send to the HO.. now what they are doing is downloading the JSP page in excel format and converting to pdf manually using the Acrobat Printer..
is that possible to change to pdf format..
for converting to excel format.. i'm just using 2 lines and it is here
You need to create pdf file using third party like iText. [ May 24, 2006: Message edited by: Dilip Kumar Jain ]
Joined: Mar 14, 2006
I think when Megha says she changed the file name to test.pdf I would assume that the change is being made to the JSP file and there would be a valid pdf file with that name. By common sense, I would not assume that she is renaming test.xls to test.pdf and hoping it to be opened by acrobat reader. But if my assumption is wrong, probably you should consider professional tools for publishing content in pdf.
Joined: Mar 22, 2006
thanks for the reply.. but it is not working properly..
the acrobat reader is opening.. with a message box..
this is the content of the message box " Adobe Reader couldnot open the file test.pdf because it is not either a supported file type or because the file has been damaged.(for example, it was sent and email attachment and wasn't correctly decoded)"
this is the error message i'm getting.. so what to do now.. the page contains table format and all.. i've give the code like this <%@ page language="java" session="true" import="java.sql.*" import="java.lang.*" contentType="application/pdf" %> <% response.setHeader("Content-Disposition","attachment;filename=test.pdf"); %>
I'll repeat the advice I gave here, where you asked the same question: 1) Don't use JSPs for stuff like this, because it's really bad design. 2) Don't use JSPs for stuff like this, because it is very likely not to work.
Joined: May 07, 2014
then how should i do............
can you give me some example
Joined: Mar 22, 2005
Move the Java code to a servlet, and then stream the resulting document to the browser.