12-05-2024, 02:40 PM | #1 | ||
Addict
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:
Quote:
Best regards, Pop |
||
12-05-2024, 02:47 PM | #2 |
Addict
Posts: 310
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
|
here is example of output
|
Advert | |
|
12-12-2024, 01:34 PM | #3 | ||
Addict
Posts: 310
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
|
Quote:
Quote:
|
||
12-12-2024, 09:39 PM | #4 |
creator of calibre
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> |
12-13-2024, 08:00 AM | #5 |
Addict
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.
|
Advert | |
|
12-13-2024, 09:17 AM | #6 |
creator of calibre
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> |
12-13-2024, 11:16 AM | #7 |
Addict
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
|
Thread Tools | Search this Thread |
|
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 | 2 | 06-09-2010 12:31 PM |