Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 10-18-2024, 04:01 AM   #31
Blaineoreski
Zealot
Blaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcover
 
Blaineoreski's Avatar
 
Posts: 118
Karma: 16268
Join Date: Apr 2020
Device: none
Dr. K & Comfy.n!



Quote:
Originally Posted by kovidgoyal View Post
With that commit, the simplest I can make it is:

Code:
<header><canvas style="width: _WIDTH_PIXELS_px; height: _HEIGHT_PIXELS_px;" width="_WIDTH_PIXELS_" height="_HEIGHT_PIXELS_"><script>
canvas = document.currentScript.parentNode
s = window.getComputedStyle(canvas)
ctx = canvas.getContext("2d");
ctx.font = s.font
ctx.fillStyle = 'black';
ctx.fillText("section: _SECTION_", 5, 5 + canvas.height / 2);
Looks like a wee level of magic!

In the GUI conversion interface, which tab should I put this code into? What are the steps?

And, would I now SKIP the two cells here entirely?

https://ibb.co/nchV4NP

Many thanks,

Ski
Blaineoreski is offline   Reply With Quote
Old 10-18-2024, 04:24 AM   #32
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,267
Karma: 6433040
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by Blaineoreski View Post

In the GUI conversion interface, which tab should I put this code into? What are the steps?

Ski
Well, as I understand, you can use just _WIDTH_PIXELS_ (or height...) instead of having to guess those values, which vary across different documents.

So, for instance, you can paste this in the Header field:


PHP Code:
<header>
<
canvas style="width: _WIDTH_PIXELS_ ; height: _HEIGHT_PIXELS_;">
<
script>
canvas document.currentScript.parentNode
window.getComputedStyle(canvas)
ctx canvas.getContext("2d");
  
ctx.font "12px sans-serif";
ctx.fillStyle 'grey';
ctx.fillText("_TITLE_"2canvas.height 3);
ctx.fillText("_SECTION_"250canvas.height 3); 
instead of

PHP Code:
<header>
<
canvas style="width: 1400 ; height: 120;">
<
script>
canvas document.currentScript.parentNode
window.getComputedStyle(canvas)
ctx canvas.getContext("2d");
  
ctx.font "12px sans-serif";
ctx.fillStyle 'grey';
ctx.fillText("_TITLE_"2canvas.height 3);
ctx.fillText("_SECTION_"250canvas.height 3); 
The numbers 2 and 250 represent the x-position, Kovid may want to correct me if this is not accurate.

Last edited by Comfy.n; 10-18-2024 at 04:34 AM.
Comfy.n is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Books with headers and footers? gracie ePub 3 08-10-2012 09:04 AM
Where is remove Headers/Footers? Anarel Calibre 4 05-25-2011 05:36 PM
Removing Headers and Footers Here's What I Did allowingtoo Workshop 0 02-16-2011 09:46 PM
Removing Headers/Footers Help? Anarel Workshop 10 11-09-2010 01:53 PM
page headers/footers daesdaemar Workshop 20 12-12-2008 10:22 PM


All times are GMT -4. The time now is 06:18 AM.


MobileRead.com is a privately owned, operated and funded community.