The rotation variable is never used in your code example and don't see
what reversing the lines would change. Post a small complete example so
that the problem can be reproduced. 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Caoimhin Barry
> Sent: Friday, October 28, 2005 12:13 PM
> To: [email protected]
> Subject: [iText-questions] Re: PdfStamper: OverContent not showing
> 
> FYI - 
> 
> As a hunch, I swapped around the two lines:
> 
> cb = stamp.getOverContent(p);
> int rotation = reader.getPageRotation(p);
> 
> to
> int rotation = reader.getPageRotation(p);
> cb = stamp.getOverContent(p);
> 
> 
> And it now works ok. Cheking the rotation after
> getting the PdfContentByte object seems to
> invalidate your PdfContentByte. Not sure if this
> is a bug or just something I missed in the FAQs.
> 
> 
> 
> 
> 
> --- Caoimhin Barry <[EMAIL PROTECTED]> wrote:
> 
> > I just discovered that if I comment out the
> > following line it now works ok:
> > 
> > rotation = reader.getPageRotation(p);
> > 
> > Any ideas? I do need to get the rotation for
> > some
> > other code I want to use
> > 
> > Thanks!
> > 
> > 
> > 
> > --- Caoimhin Barry <[EMAIL PROTECTED]> wrote:
> > 
> > > Could someone please tell me what I am doing
> > > wrong here? I am basically using the sample
> > > code
> > > from AddWatermarkPageNumbers.java but I am
> > not
> > > seeing any extra text at all. The inserted
> > page
> > > has text stamped on it, but none of the
> > others.
> > > 
> > > 
> > > PdfReader reader = new PdfReader(new
> > > RandomAccessFileOrArray("3.pdf"), null);
> > > n = reader.getNumberOfPages();
> > > //we create a stamper that will copy the
> > > document
> > > to a new file
> > > PdfStamper stamp = new PdfStamper(reader, new
> > > FileOutputStream("output.pdf"));
> > > BaseFont bf =
> > >
> >
> BaseFont.createFont(utils.properties.getProperty("fonts_path")
> +File.separator+"UVCB____.TTF",
> > > BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
> > > PdfContentByte cb;
> > > 
> > > for(int p=1; p<=n; p++){
> > >   // watermark under the existing page
> > >   //under = stamp.getUnderContent(i);
> > >   //under.addImage(img);
> > > 
> > >   // page number over the existing page
> > >   cb = stamp.getOverContent(p);
> > >   int rotation = reader.getPageRotation(p);
> > > 
> > >   cb.beginText();
> > >   cb.setFontAndSize(bf, 18);
> > >   cb.setTextMatrix(30, 30);
> > >   cb.showText("page " + p);
> > >   cb.setFontAndSize(bf, 32);
> > >   cb.showTextAligned(Element.ALIGN_LEFT,
> > > "DUPLICATE", 230, 430, 45);
> > >   cb.endText();
> > > 
> > > }
> > > 
> > > 
> > > // adding an extra page
> > > stamp.insertPage(1, PageSize.A4);
> > > cb = stamp.getOverContent(1);
> > > cb.beginText();
> > > cb.setFontAndSize(bf, 18);
> > > cb.showTextAligned(Element.ALIGN_LEFT,
> > > "DUPLICATE
> > > OF AN EXISTING PDF DOCUMENT", 30, 600, 0);
> > > cb.endText();
> > > 
> > > 
> > > 
> > > stamp.close();
> > > reader.close();
> > > stamp=null;
> > > reader=null;
> > > 
> > > 
> > >   
> > >           
> > > __________________________________ 
> > > Yahoo! Mail - PC Magazine Editors' Choice
> > 2005 
> > > http://mail.yahoo.com
> > > 
> > 
> > 
> > 
> >             
> > __________________________________ 
> > Yahoo! FareChase: Search multiple travel sites
> > in one click.
> > http://farechase.yahoo.com
> > 
> 
> 
> 
>       
>               
> __________________________________ 
> Yahoo! Mail - PC Magazine Editors' Choice 2005 
> http://mail.yahoo.com
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through End of 2005
> Visit http://www.jboss.com/services/certification for more information
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to