Hello Bruno,
I checked th emailing list for help on Page no.
Also tried the following link.
http://itextdocs.lowagie.com/examples/com/lowagie/examples/directcontent/pageevents/PageNumbersWatermark.java
http://itextdocs.lowagie.com/examples/com/lowagie/examples/directcontent/pageevents/PageNumbersWatermark.java
Actually, we are generating XML file on the fly before generating the PDF.
The code is like following:
//Form an XML String by concatenating xml tags and data in StringBuffer
//Prepare InputSource object
InputSource is2 = new InputSource(new StringReader(sampleXMLString.toString()));
InputSource is2 = new InputSource(new StringReader(sampleXMLString.toString()));
//create document
Document document = new Document(PageSize.A4, 80, 50, 30, 65);
Document document = new Document(PageSize.A4, 80, 50, 30, 65);
//In try catch - the following:
PdfWriter writer = PdfWriter.getInstance(document, baosPDF);
XmlParser.parse(document, is2);
PdfWriter writer = PdfWriter.getInstance(document, baosPDF);
XmlParser.parse(document, is2);
//The I
put the example code:
writer.setPageEvent(new PageNumbersEventHelper());
documentB.open();
// step 4: adding content
String text = "Page ";
for (int k = 0; k < n; ++k)
text += text;
Paragraph p = new Paragraph(text);
//p.setAlignment(Element.ALIGN_JUSTIFIED);
document.add(p);
// step 5: closing the document
document.close();
documentB.open();
// step 4: adding content
String text = "Page ";
for (int k = 0; k < n; ++k)
text += text;
Paragraph p = new Paragraph(text);
//p.setAlignment(Element.ALIGN_JUSTIFIED);
document.add(p);
// step 5: closing the document
document.close();
But I am getting error that document is already closed.
1. Can you please help as to how to put the page nos?
2. Is the approach right when using the XML String?
3. If not, can you give us some direction?
2. Is the approach right when using the XML String?
3. If not, can you give us some direction?
Thank you,
Regards,
Leena
Groups are talking. We´re listening. Check out the handy changes to Yahoo! Groups.
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions
