I've implementes the PageEvents in my servlet and i use the OnStartPage
method.
It works fine and see my image on every page in a table added to the
document....but it works only for the first and only page.
>From the second page to the end of the pdf file it seems that the
OnStartPage is ignored!
any idea?
this is my code:
**********************************************
public void onStartPage(PdfWriter writer, Document document) {
try{
com.lowagie.text.Image image_header =
com.lowagie.text.Image.getInstance(getServletContext().getRealPath(
"/productsheet/img/pdf_header.jpg" ));
Table datatable = new Table(1);
datatable.setPadding(1);
datatable.setSpacing(0);
datatable.setWidth(100);
Cell cell = new Cell(image_header);
cell.setBorderWidth(0);
cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER);
datatable.addCell(cell);
document.add(datatable);
}
catch(Exception e){
//some exception
}
}
************************
part of my servlet service where i call the PdfWriter, the Document and the
Page Event
*************************
ByteArrayOutputStream ba = new ByteArrayOutputStream();
PdfWriter writer = PdfWriter.getInstance(document, ba);
document.addTitle("Scheda prodotto");
document.addSubject(product_name);
document.addHeader("Expires", "0");
document.open();
onStartPage(writer, document);
writeProductSheet(document); //method that write some content in
the pdf
document.close();
response.setContentLength(ba.size());
ServletOutputStream out = response.getOutputStream();
ba.writeTo(out);
out.flush();
***********************************************************
----- Original Message -----
From: "Bruno" <[EMAIL PROTECTED]>
To: "Roberto Cipollini" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, June 26, 2003 12:06 PM
Subject: Re: [iText-questions] Image in the headerFooter of the pdf
> Quoting Roberto Cipollini <[EMAIL PROTECTED]>:
>
> > So, can anyone have a solution to have an image in the header of my
> > preciuos pdf file?
>
> Use PageEvents.
> There is an example in the tutorial.
> It doesn't have Images, but it's similar.
>
> br,
> Bruno
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: INetU
> Attention Web Developers & Consultants: Become An INetU Hosting Partner.
> Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
> INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
>
-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions