Op 15/03/2011 10:48, feureca leureca schreef:

IT DOESN'T WORK,

Why are you SHOUTING that IT DOESN'T WORK?
It works for me!
What's the problem ?

When I write such an example, there is no problem.
See attachments.
The file Leureca.java is a complete, standalone example.
The file leuraca.pdf is the resulting PDF document.
It has two pages as expected.
import java.io.FileOutputStream;
import java.io.IOException;

import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.pdf.BaseFont;
import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfWriter;


public class Leureca {

        public static void main(String[] args) throws IOException, 
DocumentException {
                Document document = new Document();
                PdfWriter writer =
                        PdfWriter.getInstance(document, new 
FileOutputStream("leureca.pdf"));
                document.open();
                PdfContentByte canvas = writer.getDirectContent();
                canvas.beginText();
                canvas.setFontAndSize(BaseFont.createFont(), 12);
                canvas.showTextAligned(Element.ALIGN_LEFT, "Page 1", 36, 806, 
0);
                canvas.endText();
                document.newPage();
                canvas.beginText();
                canvas.setFontAndSize(BaseFont.createFont(), 12);
                canvas.showTextAligned(Element.ALIGN_LEFT, "Page 2", 36, 806, 
0);
                canvas.endText();
                document.close();
        }
}

Attachment: leureca.pdf
Description: Adobe PDF document

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to