At the moment the best examples of the API are on the forum:
ChangebarsDetecting OverflowWe are working on documentation that will be available in the next release:
The box tracking API must be enabled before formatting starts with Prince.trackBoxes. It then becomes available in the oncomplete event, where you can access PDF.pages, which is a list of page boxes, and call the getPrinceBoxes() method on any DOM element. This returns a list of boxes.
Boxes are JavaScript objects with some or all of the following properties:
type = "BODY" |
"COLUMN" |
"FLEXLINE" |
"FOOTNOTES" |
"FLOATS" |
"BOX" |
"LINE" |
"SPAN" |
"TEXT" |
"SVG" |
"IMAGE"
pageNum
x
y (set to zero on some boxes)
w
h (set to zero on some boxes)
children = array of child boxes
parent = parent box
element = DOM element for box (may be null)
pseudo = pseudo-element name or null
text = string
src = URL string for images
style = CSS style object for box
Since the box tracking API is available only after the oncomplete event, it cannot be used to modify the document (see JavaScript in Printed Media). However, see The "Two-Pass" Solution for making use of its output.