View Single Post
Old 10-11-2024, 03:26 AM   #16
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,641
Karma: 7908443
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by kovidgoyal View Post
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.
Quote:
Originally Posted by Blaineoreski View Post
Hi, Comfy.n,

Yeah! Lookit' THAT:

https://ibb.co/ykLxjwF

So, sounds like a combination of the plugin and the code. Buddy, that is WICKED cool!

Yes-yes! WICKED cool indeed!

This is what worked:

PHP Code:
<header>
  <
canvas>
  <
script>
    
canvas document.currentScript.parentNode;
    
canvas.height 120;
    
canvas.width 1400;
    
ctx canvas.getContext("2d");
    
ctx.font "12px sans-serif";
    
ctx.fillStyle 'yellow';
    
ctx.fillRect(00canvas.widthcanvas.height);  
    
ctx.fillStyle 'black';
    
ctx.fillText("section: _SECTION_"5canvas.height 5); 
working unselectable header - Nineteen eighty-four - George Orwell.pdf

Comfy.n is offline   Reply With Quote