Hi
I removed every thing and tried.Its not giving any error but not displaying the pdf also.
Here is my code
<%@ page contentType="text/html;charset=ISO-8859-1"
import="java.io.*,
com.lowagie.text.*,
com.lowagie.text.pdf.*"
%>
<%!
private void addCell(PdfPTable table,
String str,int verAlig,
int holAlig,int colSpan,Font font)
{
if (str == null) str = "";
PdfPCell cell = new PdfPCell(new Phrase(str, font));
cell.setVerticalAlignment(verAlig);
cell.setHorizontalAlignment(holAlig);
cell.setColspan(colSpan);
cell.setBorderWidth(0);//Border arround the heading
table.addCell(cell);
}
%>
<%
try
{
Document document = new Document(PageSize.A4.rotate(),10, 10, 10, 10);
response.setContentType("application/pdf");
PdfWriter.getInstance(document, response.getOutputStream());
document.open();
PdfPTable headerTable = new PdfPTable(1);
headerTable.setWidthPercentage(100);
headerTable.getDefaultCell().setBorderWidth(3);
Font f1 = new Font(Font.HELVETICA, 22,Font.UNDEFINED,
java.awt.Color.blue);
addCell(headerTable, "HelloWorld",
Element.ALIGN_MIDDLE, Element.ALIGN_CENTER,0,f1);
document.add(headerTable);
document.close();
}catch(Exception e)
{
System.err.println(e.getMessage());
e.printStackTrace();
}
%>
Also i noticed.
I added <html></html> tags but still its not giving any error.
I am not able to find any reason.
Regards
Radha