Forum Feature requests

HTML element locations in the generated PDF

Given a list of HTML block elements, return a list of their positions in the generated PDF (page numbers and top and left coordinates). This will simplify digitally signing Prince-generated PDFs using third party packages. This could also have other uses.

Given the following HTML,
<div data-princeid="sig12345">text 1</div>
... more ...
<div data-princeid="sig12346">text 2</div>

return a list of positions for the elements that have data-princeid attribute:
  {princeid:"sig12345", page: 3, left: 123, top: 234, text: "text 1"},
  {princeid:"sig12346", page: 4, left: 212, top: 324, text: "text 2"}
You already have it, Håkon! Thanks for that quick guide and the pointer to the Box Tracking API. Your implementation is more complete (with width and height of the boxes) and generic. I forgot that an HTML element could take up multiple boxes and even multiple pages.

Edited by gopichandreddy