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 09-22-2016, 06:19 PM   #1
Alec Ford
Junior Member
Alec Ford began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jan 2013
Device: none
ODT -> Pdf Headers but omit on some pages

I want to have headers on my pdf output but not on the first few pages. I’m have a little knowledge in Java Script and HTML and figure from the examples that this should be possible and quite simple but my skill level isn’t up to it. Maybe I’m not asking the right questions in my searching but I can’t find anything. Any help appreciated
Alec Ford is offline   Reply With Quote
Old 09-22-2016, 08:07 PM   #2
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,598
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
IIRC PDF uses Postscript internally not HTML.

But maybe you don't need calibre to convert an ODT to PDF. One of the better features of Libre Office Writer is producing PDF's.

In Word I would make use of a Section to suppress page numbers on the front matter pages. Writer has Sections, given Writer started life as reverse engineered Word '9? it's quite likely its Sections are a clone of Word's Sections.

BR
BetterRed is offline   Reply With Quote
Advert
Old 09-22-2016, 10:41 PM   #3
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: 43,903
Karma: 22666668
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Use the following header template:

Code:
<p id="pagenum"></p><script>if (_PAGENUM_ > 5) document.getElementById("pagenum").innerHTML = "" + _PAGENUM_</script>
Change 5 to whatever number of pages you want to skip headers for.
kovidgoyal is offline   Reply With Quote
Old 09-23-2016, 06:02 AM   #4
Alec Ford
Junior Member
Alec Ford began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jan 2013
Device: none
Quote:
Originally Posted by kovidgoyal View Post
Use the following header template:

Code:
<p id="pagenum"></p><script>if (_PAGENUM_ > 5) document.getElementById("pagenum").innerHTML = "" + _PAGENUM_</script>
Change 5 to whatever number of pages you want to skip headers for.

Thanks, I should have explained a bit more, I want to take the example for title and author and put that in place of page (in your code above but I'm just not sure how to do it. Perhaps what I tried had some silly mistake but I couldn't get it to work

Code:
<p style="text-align:right"><span class="even_page">_AUTHOR_</span><p style="text-align:left"><span class="odd_page"><i>_TITLE_</i></span></p>
Alec Ford is offline   Reply With Quote
Old 09-23-2016, 07:00 AM   #5
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: 43,903
Karma: 22666668
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Code:
<p id="pagenum"></p><script>if (_PAGENUM_ > 5) document.getElementById("pagenum").innerHTML = _TITLE_ + " " + _AUTHOR_</script>
And you can change the _TITLE + " " + _AUTHOR_ to whatever fancy HTML snippet you like.
kovidgoyal is offline   Reply With Quote
Advert
Old 09-23-2016, 08:29 PM   #6
Alec Ford
Junior Member
Alec Ford began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jan 2013
Device: none
Quote:
Originally Posted by kovidgoyal View Post
Code:
<p id="pagenum"></p><script>if (_PAGENUM_ > 5) document.getElementById("pagenum").innerHTML = _TITLE_ + " " + _AUTHOR_</script>
And you can change the _TITLE + " " + _AUTHOR_ to whatever fancy HTML snippet you like.

Thanks, but, well I can get this to work
Code:
<p id="pagehead"></p><script>if (_PAGENUM_ > 1) document.getElementById("pagehead").innerHTML =  "Page "+ ( _PAGENUM_ -1) </script>
As soon as I try any property other than _PAGENUM_ I get nothing out
Alec Ford is offline   Reply With Quote
Old 09-23-2016, 11:07 PM   #7
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: 43,903
Karma: 22666668
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You have to put the other properties in quotes, like this

"_TITLE_"

because they are strings, not numbers.
kovidgoyal is offline   Reply With Quote
Old 09-24-2016, 01:05 AM   #8
Alec Ford
Junior Member
Alec Ford began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jan 2013
Device: none
Quote:
Originally Posted by kovidgoyal View Post
You have to put the other properties in quotes, like this

"_TITLE_"

because they are strings, not numbers.
Ah - that explains it, I haven't the mindset for JavaScript and when you need quotes or not.

So this is what I ended up with, maybe there's a better way. It puts page headers alternating between author and title starting at page 3

Code:
<p id="pagehead" style="text-align:center; font-size:x-large"></p><script>if ("_PAGENUM_" >2 ) {if ("_PAGENUM_" % 2 === 0) {document.getElementById("pagehead").innerHTML = "_AUTHOR_" }else {document.getElementById("pagehead").innerHTML = "_TITLE_"}}</script><p
Alec Ford is offline   Reply With Quote
Old 09-24-2016, 01:39 AM   #9
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: 43,903
Karma: 22666668
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
_PAGENUM_ must not be in quotes
kovidgoyal is offline   Reply With Quote
Old 09-24-2016, 03:05 AM   #10
Alec Ford
Junior Member
Alec Ford began at the beginning.
 
Posts: 7
Karma: 10
Join Date: Jan 2013
Device: none
Quote:
Originally Posted by kovidgoyal View Post
_PAGENUM_ must not be in quotes
It works for me both ways for me, with or without quotes, I don't know enough about JavaScript to explain it but I would agree it would be better practice to remove them.
Alec Ford is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classic Split PDF pages into smaller pages (images into tiles) Astro Barnes & Noble NOOK 4 06-12-2020 10:56 AM
PDF to doc/odt preserving table of contents Tonttu PDF 4 05-12-2012 06:10 AM
Removing headers from pdf file fotobox Calibre 2 08-30-2010 03:59 AM
Evading headers in PDF->EPUB conversion davef Calibre 6 08-29-2009 03:26 PM
Remove PDF page headers ? JohnB Calibre 9 03-27-2009 01:19 PM


All times are GMT -4. The time now is 08:24 AM.


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