I'd like to see the PDF in question…
But in general, the coordinates of fields DO NOT need to lie within page boundaries. It is perfectly valid to have a field that it outside of the coordinates – in fact, it's a quite common way to show/hide fields by simply shifting the rect "offscreen".
And there is nothing in PDF/A-1 (or 2 or 3) that would prohibit it.
Unfortunatly it is a customer document and i am not allowed to publish it...
To your answer:
Interessting. But then there should be some rules in the spec for the "viewer" so to speak?
I mean in the case half of the field is in the pdf and the other half is not - like in my case - what should a reader do?
And incase the field is outside then a viewer should not display the field at all?
What happens if you "jump" into the field with the Tab key? Or, in that case, that is forbidden?
There probably should be, but there aren't (AFAIK). Right now, all such behaviors are up to the reader.
Here is a PDF (<http://drops.pdfsages.com/UcC7>) that has some fields partially as well as completely offscreen. See what happens…
This issue is certainly something we can certainly raise in committee.
I just got another pdf in, which has negative coordinates for some of its fields.
E.g. (shortened for readability)
<</Type/Annot/F 6/T(1)/Ff 8388608/Rect[-240.608 26.5735 -64.9627 45.9284]/Subtype/Widget/FT/Tx>>
<</Type/Annot/T(2)/Ff 393216/Rect[-135.442 -118.175 -33.3329 -100.756]/FT/Ch>>
The Reader/Acrobat however puts the field inside the document. So are negative coordinates of a rectangle spec compliant, also?
I searched the spec however didn't find anything about negative rectangle coordinates...
Do I just take the absolut value?
You are right, I found the page dictionary of that page:
(shortened for readability)
<</Type/Page/CropBox[-295.667 -765.0 296.333 74.9995]/ArtBox[-269.467 -811.0 464.877 51.8296]/MediaBox[-295.667 -765.0 296.333 74.9995]>>
So form fields are placed on the media box (and not on on the other boxes)?
If CropBox is present it takes precedence in terms of which portion of the page description is shown (everything outside the CropBox is clipped). Only if the CopBox is not present, the MediaBox will also act as the CropBox. The perceived position of the form fields and annotations on the page is a result of their position in relationship to the area defined by the CropBox (or MediaBox, if no CropBox is present).
No, I think this is incorrect - all page coordinates are relative to the coordinate system:
From ISO 32000-1, Table 164:
(Required) The annotation rectangle, defining the location of the annotation on the page in default user space units.
Default user space is not relative to MediaBox or any other box.
From ISO 32000-1, Table 30:
(Required; inheritable) A rectangle (see 7.9.5, "Rectangles"), expressed in default user space units, that shall define the boundaries of the physical medium on which the page shall be displayed or printed (see 14.11.2, "Page Boundaries").
From ISO 32000-1, 188.8.131.52, User Space:
The CropBox entry in the page dictionary shall specify the rectangle of user space corresponding to the visible area of the intended output medium (display window or printed page).
Otherwise annotations and form fields would move just because someone is changing the MediaBox or CropBox values...
Ah, but if you change the MediaBox bottom left, then you are changing the effective co-ordinates of the page, so the annotations will move relative to that. Indeed, if annotations were relative to the media box bottom left, then changing the media box bottom left would leave the annotations in place. And it doesn't.
I think I'd say:
Annotations, MediaBox, CropBox, other boxes are all measured relative to the same origin, which may be within, at the edge of, or outside the visible page. This is also the origin of the co-ordinate system used in page content. Measurements are not relative to the visible page, but will coincide if the visible page bottom left is at the origin.
The term " in default user space units" is a bit unhelpful. The units clearly defines the size of a unit square, but does it define the origin?
Acrobat doesn't have low level tools for inspecting things like this (there are add-ons). However, the Crop Pages dialog shows you what it calls the CropBox. This is defined by margins rather than being a rectangle. In fact it isn't always the same as the actual stored value, since the page Rotate value is applied first. However, for the ordinary user (rather than the PDF developer) what it does is the correct and intuitive thing.
To find out the media box, set the crop values all to zero. The crop and media box will be the same.