Converting IDML to HTML5 thru script

2019-07-20 07:08发布

问题:

I am trying to convert IDML into HTML5 through script, not through InDesign. Everything comes out ok except for the rotated texts in the IDML. When the text is rotated, I take the values from ItemTransform of IDML and follow the geometrical calculations detailed in http://www.adobe.com/products/postscript/pdfs/PLRM.pdf. I get all css values correctly in HTML5 output except the "top" value. If any of you attempted this before, please let me know how to calculate the css values for IDML to HTML5. Thanks!

回答1:

When the top/y coordinate is off after rotation, it's usually because you're rotating around a different origin than you think you are. You need to make sure the origin of your rotation is at 0,0 before you rotate, so you typically translate your object to zero, then rotate, then translate it back again. It's hard to be more helpful without seeing some code - an example of the IDML input, your rotate function, and then the html5 output you're getting will probably reveal what the issue is.

This tutorial is Flash-based but is still one of the best explanations I've found of how matrix transformations work: http://www.senocular.com/flash/tutorials/transformmatrix/



标签: html5 idml