View Single Post
Old 10-10-2024, 12:09 PM   #12
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,455
Karma: 27757438
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Well you can do that in calibre as well without needing SVG by using the canvas element. Something like this for a header template

Code:
<header><canvas><script>
canvas = document.currentScript.parentNode
canvas.height = canvas.parentNode.scrollHeight
canvas.width = 1400
ctx = canvas.getContext("2d");
ctx.font = (canvas.parentNode.scrollHeight / 2) + "px sans-serif"
ctx.fillStyle = 'yellow';
ctx.fillRect(0, 0, canvas.width, canvas.height)
ctx.fillStyle = 'black';
ctx.fillText("section: _SECTION_", 5, canvas.parentNode.scrollHeight / 2);
You will need to edit the various sizes to get it to work well for your conversion.

Last edited by kovidgoyal; 10-10-2024 at 01:18 PM.
kovidgoyal is offline   Reply With Quote