openhtmltopdf icon indicating copy to clipboard operation
openhtmltopdf copied to clipboard

Find out computed element CSS style value

Open smfukaya opened this issue 9 months ago • 0 comments

Hi,

Is there a way to know (hook, subscribe, listen) before rendering (Preflight) what would be the inherited CSS styles of a inner element and somehow make on-the-fly changes to the element? For instance would somehow be possible to know that the following img inherits margin-left from p that will affect the maximum width I could set to the image in order to prevent it from going beyond the page right margin?

<style>
  p { margin-left: 5pt}
  @page{A4;margin:3cm 3cm 2cm 3cm}}
</style>
<body>
<p><img src="http://some URL" />
</p>
</body>

Best Regards, Sergio Fukaya

smfukaya avatar May 07 '24 20:05 smfukaya