Forum How do I...?

JavaScript + jQuery element positioning

craig.davis
I've been experimenting with JavaScript in the new 8 beta. I've been using JS both with and without jQuery. I would like to be able to use JS to record the position of certain elements within the layout after the final positioning and page flowing has been performed, and then send this list of positions to a service with an ajax call or used in the get request for an image. One way or another these positions need to be recorded before the pdf leaves the server.

It appears that JS may be run before the final layout has been performed. Has anyone else experimented with using JS to locate the positions of elements inside a page?
mikeday
Yes, at the moment all the JavaScript execution is finished before layout begins. Scripts can be used to transform the document in various interesting ways, but cannot yet access the final positions of elements in the PDF output. This is definitely something we plan to add, though. :)
jim_albright
I would like to know what chapter numbers are on a page so I can adjust the header:

Gen 1

Gen 2, 3

Psalm 4-6

Jim Albright
Wycliffe Bible Translators

nickp
Hi Mike, just checking in to see if any new features have been added recently that would allow me to find (and hopefully store) the position of an element once the PDF has been generated.

In case it helps, here's how I'm wanting to use this. I use Prince to generate documents that will be signed electronically. The signature lines are made with a few underscores ("______"). I'd like to be able to find the div that contains the signature line so that I can programmatically add a signature box in our electronic signature software (not to the PDF itself).

This is custom software and doesn't use any "PDF e-signature" features. As such, I don't need anything special added to the PDF itself. I just need the coordinates of the line so that later I can overlay a signature box on top of the PDF view.

Thanks in advance for your time, and thanks for such an awesome product.
mikeday
We're working on this feature right now. :)
nickp
Excellent! Thanks for the update.