with the following code i was able to insert images in the header and footer of PDF Document
try
{
FileStream fos = new FileStream(DocumentName, FileMode.Create);PdfWriter writer = PdfWriter.getInstance(myDocument, fos);
myDocument.Open();
iTextSharp.text.Image imgfoot = iTextSharp.text.Image.getInstance(footerImage);
iTextSharp.text.Image imghead = iTextSharp.text.Image.getInstance(headerImage);
imgfoot.setAbsolutePosition(0, 0);
imghead.setAbsolutePosition(0, 0);
PdfContentByte cbhead = writer.DirectContent;
PdfTemplate tp = cbhead.createTemplate(600, 250);
tp.addImage(imghead);
PdfContentByte cbfoot = writer.DirectContent;
PdfTemplate tpl = cbfoot.createTemplate(600, 250);
tpl.addImage(imgfoot);
cbhead.addTemplate(tp, 0, 715);
cbfoot.addTemplate(tpl, 0, 0);
Phrase headPhraseImg =
new Phrase(cbhead + "", FontFactory.getFont(FontFactory.TIMES_ROMAN, 7, Font.NORMAL));Phrase footPhraseImg =
new Phrase(cbfoot + "", FontFactory.getFont(FontFactory.TIMES_ROMAN, 7, Font.NORMAL));HeaderFooter header =
new HeaderFooter(headPhraseImg, true);HeaderFooter footer =
new HeaderFooter(footPhraseImg, true);}
catch (Exception ex){
}
But what i lacked is that the code inserts the image header and footer only to the first page of the document is there any way to insert the same image header and footer on every pages of the PDF Document ??
Look forward for your Help
Thanks in Advance
DAHAL SACHIT
FREE pop-up blocking with the new MSN Toolbar MSN Toolbar Get it now!
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions