Document document = new Document(PageSize.A4.rotate());
//ByteArrayOutputStream ba = new ByteArrayOutputStream();
FileOutputStream ba = new FileOutputStream("C:\\edp.rtf");
RtfWriter2 pdfW = RtfWriter2.getInstance(document, ba);
document.setHeader(worksheet1.createPageHeaderGroup());
document.open();
Table headerTable = new Table(1);
Cell picCell = new Cell();
picCell.setBorder(Rectangle.NO_BORDER);
picCell.add(new Phrase("TEST",
new Font(Font.TIMES_ROMAN, 7, Font.NORMAL)));
picCell.setHorizontalAlignment(Element.ALIGN_LEFT);
headerTable.addCell(picCell, new Point(0, 0));
document.add(headerTable);
document.newPage();
document.close();
}catch(Exception e){
System.out.println(e.toString());
}
}
private Table createHeader(String header) throws Exception{
String strImagePath = "C:\\sc_Restricted.png";
Image png = Image.getInstance(strImagePath);
Table headerTable = new Table(2);
Cell picCell = new Cell();
picCell.setBorder(Rectangle.NO_BORDER);
picCell.add(new Phrase(header + "\t\t\t\t\t\t\t\t\t",
new Font(Font.TIMES_ROMAN, 7, Font.NORMAL)));
picCell.setHorizontalAlignment(Element.ALIGN_CENTER);
headerTable.addCell(picCell, new Point(0, 0));
picCell.setBorder(Rectangle.NO_BORDER);
picCell.add(png);
picCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
headerTable.addCell(picCell, new Point(0,1));
return headerTable;
private RtfHeaderFooterGroup createPageHeaderGroup() throws Exception{
RtfHeaderFooterGroup header = new RtfHeaderFooterGroup();
header.setHeaderFooter(
new RtfHeaderFooter(createHeader("EMPLOYEE COMPETANCY PROFILE")),
com.lowagie.text.rtf.headerfooter.RtfHeaderFooter.DISPLAY_FIRST_PAGE);
header.setHeaderFooter(
new RtfHeaderFooter(createHeader("EMPLOYEE DEVELOPMENT WORKSHEET")),
com.lowagie.text.rtf.headerfooter.RtfHeaderFooter.DISPLAY_LEFT_PAGES);
header.setHeaderFooter(
new RtfHeaderFooter(createHeader("EMPLOYEE DEVELOPMENT WORKSHEET")),
com.lowagie.text.rtf.headerfooter.RtfHeaderFooter.DISPLAY_RIGHT_PAGES);
return header;
in footer or header depending what i set
Please help.
Thanks,
Oleg
------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp & Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system.
------------------------------------------------------------------------------
