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-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,612
Karma: 7891011
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
Old 10-11-2024, 05:10 AM   #17
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,373
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
This should help as well:
https://github.com/kovidgoyal/calibr...db935e5bd53fe1
kovidgoyal is offline   Reply With Quote
Old 10-11-2024, 05:16 AM   #18
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,373
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
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);
kovidgoyal is offline   Reply With Quote
Old 10-11-2024, 05:29 AM   #19
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,612
Karma: 7891011
Join Date: Sep 2020
Device: none
That makes it easier, for sure, thanks!

I'm going to play more with it later.

BTW I was curious about the new TTS developments and found that in the latest available preview there's something not working correctly when changing voices. Also, I was asked to restart the PC (Windows OS), but I'm pretty sure I had all Calibre stuff (editor, viewer) already closed before installing. But I may be wrong about this.

The TTS issue is that I have to re-open the book to have the voice change to another one.

Oh, and I forgot to thank you for the pause after sentence setting. It's a very interesting addition.
Comfy.n is offline   Reply With Quote
Old 10-11-2024, 06:05 AM   #20
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,612
Karma: 7891011
Join Date: Sep 2020
Device: none
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);
upon a quick test I confirm it is working fine, here's the output:
header after new commit - Nineteen eighty-four - George Orwell.pdf

On current version I found these settings to look fine, with a white transparent background and grey text:

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 'transparent';
    
ctx.fillRect(00canvas.widthcanvas.height);  
    
ctx.fillStyle 'grey';
    
ctx.fillText("_TITLE_"2canvas.height 3);
    
ctx.fillText("_SECTION_"250canvas.height 3);
    
ctx.fillText("_AUTHOR_"500canvas.height 3); 
PHP Code:
<footer>
  <
canvas>
  <
script>
    
canvas document.currentScript.parentNode;
    
canvas.height 120;
    
canvas.width 1400;
    
ctx canvas.getContext("2d");
    
ctx.font "12px sans-serif";
    
ctx.fillStyle 'transparent';
    
ctx.fillRect(00canvas.widthcanvas.height);  
    
ctx.fillStyle 'grey';
    
ctx.fillText("_PAGENUM_/_TOTAL_PAGES_"260canvas.height 3); 
looks like this:
header and footer white bg grey text - Nineteen eighty-four - George Orwell.pdf

I've attached the trimmed EPUB I used if someone wants to do further testing
Attached Files
File Type: epub trimmed-Nineteen eighty-four - George Orwell.epub (61.3 KB, 118 views)

Last edited by Comfy.n; 10-11-2024 at 06:38 AM.
Comfy.n is offline   Reply With Quote
Old 10-11-2024, 09:58 AM   #21
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,373
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by Comfy.n View Post
The TTS issue is that I have to re-open the book to have the voice change to another one.
This is with the Piper backend?
kovidgoyal is offline   Reply With Quote
Old 10-11-2024, 11:15 AM   #22
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,612
Karma: 7891011
Join Date: Sep 2020
Device: none
Also with legacy. I've tried a portable preview with a fresh profile and the issue didn't manifest at first, however it did after further tests as well either when trying to switch between piper voices or legacy ones.
Comfy.n is offline   Reply With Quote
Old 10-16-2024, 11:23 AM   #23
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,373
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by Comfy.n View Post
Also with legacy. I've tried a portable preview with a fresh profile and the issue didn't manifest at first, however it did after further tests as well either when trying to switch between piper voices or legacy ones.
https://github.com/kovidgoyal/calibr...43f640cc24f43b
kovidgoyal is offline   Reply With Quote
Old 10-16-2024, 11:54 AM   #24
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,612
Karma: 7891011
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by kovidgoyal View Post
That fixed for me the issue of a "sticky" voice (wouldn't get changed), although I got the error below upon running TTS initially and also a couple of times when changing voices. Later I'll be able to do more tests.
Code:
calibre, version 7.19.101
ERROR: Read aloud failed: piper process failed with exit code: -1073740791 and error messages:

I'm using 7.19 stable version then running this bat script with latest source:

Code:
Rem You can run the GUI as
Echo "Minimise this window, Don't Close"
set CALIBRE_DEVELOP_FROM=C:\users\user\calibre-master\src
set dt="%date:~-4,4%-%date:~-7,2%-%date:~-10,2%,%time:~0,2%_%time:~3,2%_%time:~6,2%"


calibre-debug -g 1>> log-dev-%dt%.txt 2>&1

Last edited by Comfy.n; 10-16-2024 at 02:13 PM.
Comfy.n is offline   Reply With Quote
Old 10-16-2024, 12:06 PM   #25
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,373
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That's the piper binary crashing I doubt that has anything to do with calibre. It's a standalone executable. If you can find a way to reproduce I can try to debug but it doesnt crasha t all for me on my windows system.
kovidgoyal is offline   Reply With Quote
Old 10-16-2024, 02:11 PM   #26
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,612
Karma: 7891011
Join Date: Sep 2020
Device: none
I've restarted PC and still got the crash. I suspect it's related to the pt-pt voice named tugão, as it only happens if I have/had it selected.
Comfy.n is offline   Reply With Quote
Old 10-16-2024, 10:00 PM   #27
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,373
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
That should be reported to the piper project in that case: https://github.com/rhasspy/piper
kovidgoyal is offline   Reply With Quote
Old 10-17-2024, 05:45 AM   #28
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,612
Karma: 7891011
Join Date: Sep 2020
Device: none
I've edited piper-voices.json to read tugao instead of tugão, as well as the filenames in calibre-cache and got it to work!

So perhaps piper doesn't like the tilde, or the tug\u00e3o representation.
Comfy.n is offline   Reply With Quote
Old 10-17-2024, 05:53 AM   #29
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,373
Karma: 27230406
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
See if this fixes it. The voice will be re-downloaded using a pure ascii filename.
kovidgoyal is offline   Reply With Quote
Old 10-17-2024, 11:11 AM   #30
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,612
Karma: 7891011
Join Date: Sep 2020
Device: none
Quote:
Originally Posted by kovidgoyal View Post
See if this fixes it. The voice will be re-downloaded using a pure ascii filename.
yup
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 08:04 AM
Where is remove Headers/Footers? Anarel Calibre 4 05-25-2011 04:36 PM
Removing Headers and Footers Here's What I Did allowingtoo Workshop 0 02-16-2011 08:46 PM
Removing Headers/Footers Help? Anarel Workshop 10 11-09-2010 12:53 PM
page headers/footers daesdaemar Workshop 20 12-12-2008 09:22 PM


All times are GMT -4. The time now is 05:08 AM.


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