Mr Lowagie,

I have determine the error of my ways. Actually, a colleague pointed out 
that my code assumed a document always had a llx, lly = (0.0, 0.0).

I have updated my code with something similar to:

        // calculate the initial x, y from where we 
                // start adding the signature lines on the document   
                int x= (int) ((pageSize.left() + pageSize.width() / 2) + 
(SecAddWater.copyFontSize/2) * Math.sin(waterAngleRadians));
                int y= (int) ((pageSize.bottom() + pageSize.height() / 2) 
- (SecAddWater.copyFontSize /2) * Math.cos(waterAngleRadians));
 
                // calculate x and y increment values which we can use
                // to determine the centre coordinates for the succeding 
                // signature lines 
                int xIncr = (int) 
((SecAddWater.signFontSize+SecAddWater.signLeading) * 
java.lang.Math.sin(waterAngleRadians)); 
                int yIncr = (int) 
((SecAddWater.signFontSize+SecAddWater.signLeading) * 
java.lang.Math.cos(waterAngleRadians));

Best Regards,

Chris Madison
IBM Certified Application Architect
Wireless e-business Services Practice
Office/FAX: +1 704 719 2041
Mobile: +1 704 287 9084
e-mail: [EMAIL PROTECTED]



"Bruno Lowagie (iText)" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
11/29/2006 03:30 AM
Please respond to
Post all your questions about iText here 
<itext-questions@lists.sourceforge.net>


To
Post all your questions about iText here 
<itext-questions@lists.sourceforge.net>
cc

Subject
Re: [iText-questions] Adding Text to PDF document is off the page






Christopher M Madison wrote:
> The watermark text is applied 
> to the document, but WAY off of the page.

OK, let's have a look.

> Here is what Adobe Designer (xml view)  has for the first character is 
the 
> watermark:
> 
> <draw name="T01" x="3.842in" y="320.898in" minW="0.312in" 
> minH="0.312in">

Not sure where this XML snippet comes from
(not from iText), but in this case
x = 276.624 points
y = 23104.656 points

> The y value is at 320.898 inches! This is WAY OFF.

Not necessarily.

> I am using the PDFStamper method of (based on the online example) to 
> watermark the document.
> 
> Using the iText API I've determined that the pages are LEGAL size. 
> Further, I found this to be interesting (from PDFReader.getPageSize(i)):

getPageSizeWithRotation also gives you the rotation,
but that's not important here.

> llx = 0.0
> lly = 22584.0
> urx = 612.0
> ury = 23592.0
> 
> ury - lly = 1008!!!

That's page size LEGAL: 612 x 1008 points.
When iText creates a page with this size:
llx = 0.0
lly = 0.0
urx = 612.0
ury = 1008.0

Apparently, the Pdf tool you have been using,
has an offset of 22584.0 points for the Y value.
You want to place your watermark at position
y = 23104.656 - 22584.0 = 520.656 points
which is 7.231 inches from the bottom.

> How can I adjust the lly and ury of the document? Or how can I move the 
> text onto the page?

I'm not able to answer this question right away,
I'm just thinking along with you. It would be
interesting to have the code snippet you are using
to see what goes wrong.

br,
Bruno

-------------------------------------------------------------------------
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
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/



-------------------------------------------------------------------------
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
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to