![]() |
#1 | ||
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 320
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 |
||
![]() |
![]() |
![]() |
#2 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 320
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
|
here is example of output
|
![]() |
![]() |
Advert | |
|
![]() |
#3 | ||
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 320
Karma: 2228060
Join Date: Dec 2013
Location: LaVernia, Texas
Device: kindle epub readers on android
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
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> |
![]() |
![]() |
![]() |
#5 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 320
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 | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,345
Karma: 27182818
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> |
![]() |
![]() |
![]() |
#7 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 320
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 | Thread Starter | Forum | Replies | Last Post |
REGEX to Remove Embedded Header/Footer in the Text from a PDF? | enuddleyarbl | Conversion | 4 | 06-24-2023 03:30 AM |
Avoid pdf header and footer in the beginning of chapters | alexandreaquiles | Conversion | 0 | 10-09-2014 03:02 PM |
software to remove pdf header, footer | cybmole | Conversion | 31 | 04-18-2011 02:37 AM |
PDF Conversion - Removing Header / Footer Text | heb | Sony Reader | 9 | 07-11-2010 11:02 PM |
Cropping a header and footer from a PDF (Page numbers etc) | NickS | 2 | 06-09-2010 11:31 AM |