I am trying to understand the equivalency of some structure in the SDK and how they relate to a Cartesian coordinate system. I feel like some of these questions are dumb, but I don’t want to make assumption and continue with a false sense of understanding of the how the structures maps. In an attempt to express my confusion clearly, I have broken down these into multiple questions.
Question 1. How does an ASFixedPoint map to x and y?
Given an ASFixedPoint, is it safe to assume that:
I took to assume that h was short for horizontal, and v for vertical
Question 2. How does a rectangle expressed as [left top right bottom] map to an ASFixedQuad?
Here’s the source of my confusion: in the PDF Reference V1.7, Section 3.8.4, a rectangle is said to be specified by an array that takes the form:
[ll_x, ll_y, ur_x, ur_y]
ll_x is lower-left x,
ll_y is lower-left y,
ur_x is upper-right x,
ur_y is upper-right y
The passage also states specifying the other set of opposite is okay.
The rectangle structure is also allowed to be specified as [left, top, right, bottom] (this is what the ASFixedRect are specified as)
My question is, what is the mapping of these coordinates?
Is the following correspondence correct:
left -> upper left x,
Top -> upper left y
Right -> lower right x,
Bottom -> lower right y
I know this question might be super simple, but I don't want to make assumptions about the SDK as I have in the past.
Fixed point values are not integers or floating point and must not be typecast to them (Not what you ask, but a common error). The types in the API are often derived from info in a PDF but may be an abstraction. Never assume correspondence unless explicitly documented. h and v are horizontal and vertical, so x and y respectively. ASFixedQuad values may not be rectangles. The API would often use ASFixedRect in the case where a value is an axis aligned rectangle.
Copy link to clipboard
Do what I do, try it and see.
I've written endless test plug-ins for Acrobat. It's the only way to really know.