You only can parse JSP as a HTML output!
So you have to save the jsp output let's say, to a byte array in memory or a
string orbject or maybe into database!
And then you can use HTMLWorker object to parse that HTML snippet and
produce the PDF!
Here is an example:
........
String html = <p>Who is your daddy?</p>
InputStream s = new ByteArrayInputStream(html.getBytes());
List<Element> footer = HTMLWorker.parseToList(new
InputStreamReader(s), new StyleSheet());
if(footer.size()>0) {
elements.addAll(footer);
}
//Add parsed template
if (elements.size() > 0) {
for (Element e : elements)
document.add(e);
}
Hope it will be helpfull!
Br
Rico
Hi
Thankyou Rico for ur response i am little bit confused with ur explanation
how to parse jsp as a Html output ok now i am sending my jsp page and i want
this page to be converted as pdf using itext
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@ page language = "java" contentType = "text/html" %>
<%...@page import="com.sellspace.util.DatabaseConnection,java.sql.*" %>
<%
String path = request.getContextPath();
String basePath =
request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<body>
<%
String user="";
try{
user=session.getAttribute("loginuser").toString();
}catch(Exception e){
user=null;
}
%>
<%if(user==null){
out.println("please login first");
}else{%>
<table align="right"><tr><td>
logout.jsp Logout
</td></tr></table>
<table align="center" border="1">
<tr><th class = "fieldcell" >Siteid</th><th class =
"fieldcell">Url</th></tr>
<% String query=("select siteid,url from dbo.siteownerdetails where
uname='"+user+"' ");
try
{
java.sql.Connection con = DatabaseConnection.getConnection();
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(query);
while(rs.next())
{
String siteid=rs.getString(1);
String url=rs.getString(2);
%>
<tr><td align="center"><%= siteid %></td><td align="center"><%=url %></td>
</tr>
<%
}
}catch(Exception e)
{
e.printStackTrace();
}
}%>
</table>
</body>
</html>
pls help me how convert this jsp page as pdf using urs itext.I am waiting
for ur reply Thanx in advance.
--
View this message in context:
http://www.nabble.com/how-to-convert-my-jsp-output-as-pdf-through-itext-tp24073537p24086853.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/