Forum Feature requests

DOM styleSheets access via JavaScript and/or CSS calc() support

cscalfani
I'm trying to place MICR text for a check report which requires very accurate placement and I'd like to either be able to do calculations in Javascript which requires knowledge of the page margin.

I tried 2 different ways:

1. CSS calc() --- this is NOT supported
2. Javascript access to document.styleSheets[0].rules.item('@page').style.marginLeft --- access to styleSheets is not supported

Either or both would be really great otherwise I have to change the margin TWO places on the page.
mikeday
Currently there is no mechanism to access the page margin size from JavaScript before typesetting, so you will need to use a CSS rule.

You could use JavaScript to set the page margin in one place, but I'm not sure if that would be worth the effort.
cscalfani
If I cannot GET the rule, how can I SET the rule?
mikeday
You could set it by creating a new <style> element and inserting it into the document. It's not very elegant, though.