How did you figure that out? PdfWriter.getPageSize() and PdfWriter.getBoxSize("media") are both giving me 595.0x842.0.

Thanks

Paulo Soares wrote:
The mediabox in the secon page is:

Array:4
.   [0] 0 (Number)
.   [1] 12407.09961 (Number)
.   [2] 612 (Number)
.   [3] 13199.09961 (Number)

which means that you must add 12407.09961 to the y axis to show anything.

Paulo 

  
-----Original Message-----
From: Michael Mrozek [mailto:[email protected]] 
Sent: Thursday, April 30, 2009 2:01 AM
To: [email protected]
Subject: [iText-questions] Problem stamping a certain PDF

This is almost certainly a dumb question as I have very little iText
experience, but I've been through the list archives and miscellaneous
websites and can't figure it out. There's a sample PDF at
http://mrozekma.com/itext.pdf that won't display text I stamp on it.
It's some property of the pages rather than the entire document; the
first page is a page I added manually with PdfStamper.insertPage, and
that page has the "This is a test" text I'm trying to add to 
both pages,
but the second page that was part of the original document shows
nothing. Unless I'm checking wrong, there doesn't appear to be a crop
box or any odd rotations, the usual things that cause text to not show
up when it should. Here's the code I'm running (I changed the text
matrix Y from 300 to 350 so rerunning it shows two lines of 
text on the
first page):

            final PdfReader reader = new PdfReader("/tmp/itext.pdf");
            final FileOutputStream os = new
FileOutputStream("/tmp/out.pdf");
            final PdfStamper stamper = new PdfStamper(reader, os);
          
            final BaseFont font =
BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI,
BaseFont.EMBEDDED);

//            This was used to create the first page in the current
itext.pdf:
//            stamper.insertPage(1, PageSize.LETTER);
           
            PdfContentByte content = null;
            for(int page = 1; page <= 
reader.getNumberOfPages(); page++) {
                content.beginText();
                content.setFontAndSize(font, 10);
                content.setColorFill(Color.RED);
                content.setTextMatrix(50, 350);
                content.showText("This is a test");
                content.endText();
            }
           
            stamper.close();
            os.close();


I've been using iText in a project I'm working on and this is 
the first
document I've had a problem with; I can't figure out what's different
about this particular one. Thanks for any ideas
    


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.


  

------------------------------------------------------------------------------ Register Now & Save for Velocity, the Web Performance & Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance & Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf

_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to