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 11-26-2021, 02:13 AM   #1
read&learn
Junior Member
read&learn began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Nov 2021
Device: Calibre
EPUB->PDF conversion: text align not effective in footer template for page number

Calibre 5.0

The following footer template always generates a page number on the left side of footer area regardless of odd/even page, instead of alternating for even and odd pages.
Code:
<p id="pagenum" style="text-align:left">_PAGENUM_</p><script>if (_PAGENUM_ % 2 == 0) document.getElementById("pagenum").style.textAlign = "right";</script>
Please advise how to fix it. Thanks!
read&learn is offline   Reply With Quote
Old 11-26-2021, 02:58 AM   #2
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,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You dont need javascript for this, use the second example from https://manual.calibre-ebook.com/con...verting-to-pdf
kovidgoyal is offline   Reply With Quote
Advert
Old 11-29-2021, 01:56 AM   #3
read&learn
Junior Member
read&learn began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Nov 2021
Device: Calibre
Thanks!

However, page numbers are always on right side of page with this template
Code:
<header style="justify-content: flex-end; font-size: smaller">
    <div class="even-page">_PAGENUM_</div>
    <div class="odd-page">_PAGENUM_</div>
</header>
and always on the left side of every page with this template
Code:
<header>
    <div class="even-page" style="justify-content: flex-start; font-size: smaller">_PAGENUM_</div>
    <div class="odd-page" style="justify-content: flex-end; font-size: smaller">_PAGENUM_</div>
</header>
and did not alternate on odd/even page.
read&learn is offline   Reply With Quote
Old 11-29-2021, 02:42 AM   #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: 45,359
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Code:
<header style="font-size: smaller">
    <div class="even-page">_PAGENUM_</div>
    <div class="odd-page" style="text-align: right; width: 100%">_PAGENUM_</div>
</header>
kovidgoyal is offline   Reply With Quote
Old 11-29-2021, 04:28 AM   #5
read&learn
Junior Member
read&learn began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Nov 2021
Device: Calibre
Quote:
Originally Posted by kovidgoyal View Post
Code:
<header style="font-size: smaller">
    <div class="even-page">_PAGENUM_</div>
    <div class="odd-page" style="text-align: right; width: 100%">_PAGENUM_</div>
</header>
Works like wonder. Many thanks!
read&learn is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't see Page Number in footer section The_Ad Viewer 2 12-05-2020 12:09 AM
HTML to PDF Conversion TOC position and page number olimpoweb Conversion 4 03-14-2018 05:13 PM
Image in PDF footer template ciarant Conversion 2 05-04-2015 06:34 PM
page-template.xpgt conversion problems in ePub slantybard Conversion 17 04-19-2011 05:44 AM
PDF Conversion - Removing Header / Footer Text heb Sony Reader 9 07-11-2010 11:02 PM


All times are GMT -4. The time now is 12:34 PM.


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