Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 12-05-2024, 02:40 PM   #1
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 310
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
PDF complex header/footer design

Here is code for EPUB to PDF conversion to make a one-line footer with Left, Center, and Right. The Left and Right swap places for odd and even numbered pages. In this example there is a 'dummy' section that is blank, but anything such as _AUTHOR_ could be added.

Quote:
<footer>
<div class='odd-page' style='width:20%'>_PAGENUM_</div>
<div class='odd-page' style='text-align:center; width:60%'> <b>_SECTION_</b></div>
<div class='odd-page' style='width:20%'>*</div>
<div class='even-page' style='width:20%'>*</div>
<div class='even-page' style='text-align:center; width:60%;'> <b>_SECTION_</b></div>
<div class='even-page' style='width:20%'>_PAGENUM_</div>
</footer>
I tried making a snippet for this, but snippets don't work on this footer input line in the converter. You can store it as a non-functioning snippet which you use via copy and paste. You can store this code elsewhere, then copy and paste it into the footer input line. Alternately, you can use .XCompose which works everywhere. The .XCompose line for this is:

Quote:
<Multi_key> <f><f>:"<footer><div class='odd-page' style='width:20%'>_PAGENUM_</div><div class='odd-page' style='text-align:center; width:60%'> <b>_SECTION_</b></div><div class='odd-page' style='width:20%'></div><div class='even-page' style='width:20%'></div><div class='even-page' style='text-align:center; width:60%;'> <b>_SECTION_</b></div><div class='even-page' style='text-align:right; width:20%'>_PAGENUM_</div></footer>"
So, all you need to do is go to the footer input line, then Ctrl_r, f, f. Hope this is useful for someone. If anyone can simplify the code I would be happy to see it. I cannot offer food, but you would have my undining gratitude.
Best regards, Pop
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2024-12-05 12-13-36.png
Views:	50
Size:	193.8 KB
ID:	212361  
rjwse@aol.com is offline   Reply With Quote
Old 12-05-2024, 02:47 PM   #2
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 310
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
here is example of output
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2024-12-05 12-43-07.png
Views:	63
Size:	312.5 KB
ID:	212362  
rjwse@aol.com is offline   Reply With Quote
Advert
Old 12-12-2024, 01:34 PM   #3
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 310
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
Quote:
<script>document.currentScript.parentNode.querySel ector("div").innerHTML = "" + (_PAGENUM_ + 3)</script>
Quote:
<footer>
<div class='odd-page' style='width:10%'>_PAGENUM_</div>
<div class='odd-page' style='text-align:center; width:80%'> <b>_SECTION_</b></div>
<div class='odd-page' style='width:10%'>*</div>
<div class='even-page' style='width:10%'>*</div>
<div class='even-page' style='text-align:center; width:80%;'> <b>_SECTION_</b></div>
<div class='even-page' style='text-align:right; width:10%'>_PAGENUM_</div>
</footer>
looking for help, please, for being able to combine 'start at' script with the above '3 element, alternating even/odd' footer. I tried various combinations of inclusion of the style, but it always stalls out. I tried a kazillion different combos, but I'm not adept at coding beyond css. In advance, thanks, Pop
rjwse@aol.com is offline   Reply With Quote
Old 12-12-2024, 09:39 PM   #4
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: 44,764
Karma: 24967300
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Code:
<footer>
<div class='odd-page' style='width:10%' id='footer-pagenum'>_PAGENUM_</div>
<div class='odd-page' style='text-align:center; width:80%'> <b>_SECTION_</b></div>
<div class='odd-page' style='width:10%'>*</div>
<div class='even-page' style='width:10%'>*</div>
<div class='even-page' style='text-align:center; width:80%;'> <b>_SECTION_</b></div>
<div class='even-page' style='text-align:right; width:10%'>_PAGENUM_</div>
<script>document.currentScript.parentNode.querySelector("div#footer-pagenum").innerHTML = "" + (_PAGENUM_ + 3)</script>
</footer>
kovidgoyal is offline   Reply With Quote
Old 12-13-2024, 08:00 AM   #5
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 310
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
Thanks for this code, but I already tried this and it only picks up odd-page. The odd-page is correctly incremented, but the even-page stays the same. I tried this via using unique classes also. It always picks up the first thing mentioned so I tried using || and so forth. It is tricky. I tried using two scripts, too. So far, no cigar.
rjwse@aol.com is offline   Reply With Quote
Advert
Old 12-13-2024, 09:17 AM   #6
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: 44,764
Karma: 24967300
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Code:
<footer>
<div class='odd-page pagenum' style='width:10%'>_PAGENUM_</div>
<div class='odd-page' style='text-align:center; width:80%'> <b>_SECTION_</b></div>
<div class='odd-page' style='width:10%'>*</div>
<div class='even-page' style='width:10%'>*</div>
<div class='even-page' style='text-align:center; width:80%;'> <b>_SECTION_</b></div>
<div class='even-page pagenum' style='text-align:right; width:10%'>_PAGENUM_</div>
<script>document.currentScript.parentNode.querySelectorAll("div.pagenum").forEach((x) => { x.innerHTML = "" + (_PAGENUM_ + 3);})</script>
</footer>
kovidgoyal is offline   Reply With Quote
Old 12-13-2024, 11:16 AM   #7
rjwse@aol.com
Addict
rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.rjwse@aol.com ought to be getting tired of karma fortunes by now.
 
rjwse@aol.com's Avatar
 
Posts: 310
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
that did it!

That did it! I cannot thank you enough. I 'see' the 'for each' and why this works. Warmest regards and Happy Holidays, Pop
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2024-12-13 09-12-17.png
Views:	45
Size:	327.5 KB
ID:	212474  
rjwse@aol.com is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
REGEX to Remove Embedded Header/Footer in the Text from a PDF? enuddleyarbl Conversion 4 06-24-2023 04:30 AM
Avoid pdf header and footer in the beginning of chapters alexandreaquiles Conversion 0 10-09-2014 04:02 PM
software to remove pdf header, footer cybmole Conversion 31 04-18-2011 03:37 AM
PDF Conversion - Removing Header / Footer Text heb Sony Reader 9 07-12-2010 12:02 AM
Cropping a header and footer from a PDF (Page numbers etc) NickS PDF 2 06-09-2010 12:31 PM


All times are GMT -4. The time now is 03:45 AM.


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