Okay, hopefully this will explain it a little better. For testing, I'm using
the PDF document http://www.irs.gov/pub/irs-pdf/fw9.pdf -- Here is an image
I made to better explain what I'm doing:
http://img64.imageshack.us/img64/2097/pdf.png

Now,  The blue box is where that field should be (you can check on the main
PDF), I also put the white spacing I'm talking about, along with a red
border around the part of the PDF that isn't in the white spacing. (Pulling
a PDF into Photoshop, or opening it in Adobe Reader and "remove white
margins" removes everything on the outside of the red border).

Now the green box is 30 points to where the field is supposed to be in terms
of left on the field position. The yellow is 65 which would include the
white spacing. Now for some reason, that field, iText is giving me a
position of left: 23.690000534057617 / bottom: 651.7000122070312

Is there something I'm doing wrong that I'd get these positions? I'm using
getFieldPositions to figure out the positions of the fields.

Thanks Leonard for your time, if I sound confusing let me know and I'll try
to explain a bit better. I know there is no such thing as "margins" in
PDF's, I was hoping that the red border is a box (see image), but
getCropBox() is returning the pages width/height (611x791) which I'm
guessing is because there isn't a cropbox so it's defaulting to the page
size.


Leonard Rosenthol-3 wrote:
> 
> I don't know where you heard that "positioning is relative to whitespace"
> - that is simply NOT TRUE.
> 
> All coordinates in the PDF are relative to the origin of the MediaBox of
> the page.  PERIOD.
> 
> That said - if the page has no CropBox then everything is perfect and no
> problems.
> 
> HOWEVER, when the page HAS a CropBox (which impacts the VISUAL DISPLAY but
> not the coordinates) then you need to be sure to adjust your coordinates
> relative to the new coordinate system.
> 
> Leonard
> 
> -----Original Message-----
> From: Lloyd [mailto:[email protected]] 
> Sent: Wednesday, October 07, 2009 2:48 PM
> To: [email protected]
> Subject: [iText-questions] Acro form positioning + margins
> 
> 
> Hello,
> 
> I'm writing an application that grabs the field positions in a PDF. I
> noticed that the positioning of these (LEFT, BOTTOM) are relative to the
> white spacing in a PDF. Now, from what I've read on the mailing list,
> there
> is no such things as margins. I've noticed that when loading the PDF up in
> a
> program like Photoshop, the spacing disappears, while if I load the PDF up
> in Adobe Reader, or I capture an image of it in GhostScript the spacing is
> there.
> 
> My question is, is there anyway to get the spacing details? Is the
> "content"
> inside some kind of rectangle box so I can figure out the spacing?
> 
> The reason I want this is I'm converting the field positions to pixels,
> and
> placing them over an image of the PDF. This image will contain the white
> spacing and I need these numbers to position the fields correctly.
> 
> The only option I've come up with is to get the width of the PDF with the
> spacing, then use a program like GhostScript to generate the PDF with no
> margin at all, and then compare the width/height to get the spacing. I'm
> hoping there is an easier way.
> 
> If anyone has any suggestions it would be greatly appreciated. Thanks in
> advanced.
> -- 
> View this message in context:
> http://www.nabble.com/Acro-form-positioning-%2B-margins-tp25795037p25795037.html
> Sent from the iText - General mailing list archive at Nabble.com.
> 
> 
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> 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/
> 
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay 
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> 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/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Acro-form-positioning-%2B-margins-tp25795037p25797836.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
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