Current File : /home/obabain/khb_obaba_in/SalesOrderpdf.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
   <%@page import="javax.swing.border.TitledBorder"%>
<%@page import="java.io.*,
com.lowagie.text.*,
com.lowagie.text.pdf.*"
 
%>



<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%!
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(),50, 50, 50, 50);
response.setContentType("application/pdf");
PdfWriter.getInstance(document, response.getOutputStream());
document.open();
PdfPTable headerTable = new PdfPTable(1);
headerTable.setWidthPercentage(100);
headerTable.getDefaultCell().setBorderWidth(3);
PdfPCell cell = new PdfPCell(new Phrase("ERP Software"));
//Image img = Image.getInstance("/img/good_or_tick.png");
//PdfPCell cellimg = new PdfPCell(img, true);
Font f1 = new Font(Font.HELVETICA, 10,Font.UNDEFINED,java.awt.Color.BLACK);
		Font f2=new Font(Font.TIMES_ROMAN,20,Font.BOLD,java.awt.Color.BLACK);

addCell(headerTable, "Original copy for customer",
Element.ALIGN_MIDDLE, Element.ALIGN_RIGHT,0,f1);
document.add(headerTable);

PdfPTable Table = new PdfPTable(1);
Table.setWidthPercentage(100);
Table.getDefaultCell().setBorderWidth(1);

//addCell(Table,"a",Element.ALIGN_CENTER,Element.ALIGN_CENTER,1,f2);
cell.setFixedHeight(30);
cell.setBorder(Rectangle.BOX);
cell.setColspan(0);
cell.setPaddingLeft(350);
cell.setBackgroundColor(java.awt.Color.LIGHT_GRAY);

Table.addCell(cell);
document.add(Table);
/* PdfPTable Tablesub = new PdfPTable(1);
Tablesub.setWidthPercentage(100);
Tablesub.getDefaultCell().setBorderWidth(1);
PdfPCell cellsub = new PdfPCell(new Phrase("Purchase Order"));
//addCell(Table,"a",Element.ALIGN_CENTER,Element.ALIGN_CENTER,1,f2);
cellsub.setFixedHeight(30);
cellsub.setBorder(Rectangle.BOX);
cellsub.setColspan(0);
cellsub.setPaddingLeft(350); 
//cellsub.setBackgroundColor(java.awt.Color.GRAY);

Tablesub.addCell(cellsub);
document.add(Tablesub);*/
//document.add(image);

document.add(Chunk.NEWLINE);  
Paragraph pp=new Paragraph();
document.add(new Paragraph());

//document.add(new Paragraph("\t\t\t\t----------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n"));
document.add(new Paragraph("\t\t\t\tOrder No:\n \t\t\t\tOrder Date:\n\t\t\t\tDispatch through:\n\t\t\t\tDestination"));
document.add(new Paragraph("\t\t\t\t--------------------------------------------------------------------------------------------------------------------\n"));
document.close();

}catch(Exception e)
{
System.err.println(e.getMessage());
e.printStackTrace();
}
%>


</body>
</html>