View Single Post
Old 05-25-2025, 10:32 AM   #5
py_make_book
Junior Member
py_make_book began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jul 2022
Device: none
I'm sure you don't need this anymore, but if this is helpful to others in the future, I got this working.

I'm using Python for stuff, but hopefully you can see what I'm doing here and modify it for your purposes, minus the Python stuff. Should be straightforward to just create the command line option (i.e. you do not need Python for this):

Code:
        # Define footer templates with JavaScript to hide page number on page 1
        # Note the use of single quotes for the outer HTML attributes and escaped double quotes for JavaScript strings if needed.
        centered_footer_script = "if (_PAGENUM_ === 1) { var el = document.getElementById('pn_center_id'); if (el) el.innerHTML = ''; }"
        centered_footer_html = f"<footer><div id='pn_center_id' style='margin: auto; font-size: smaller;'>_PAGENUM_</div><script>{centered_footer_script}</script></footer>"

        # The entire template string needs to be quoted for the command line.
        cmd_parts.append(f'--pdf-footer-template="{centered_footer_html}"')
py_make_book is offline   Reply With Quote