Conversion to PDF with calibre should show table of content with page numbers
The table of contents end up showing the section numbers to the right instead of the page numbers. Having it display the page numbers is generally what's expected.
I am not sure if this is the right place to post about this, but it'd be nice if there's a method in the book.json which would allow the book to be rendered with page numbers in the Table of Contents than the section numbers.
This is how the rendered book using gitbook pdf looks as of now.
The book lies at : https://github.com/GameAutomators/eBook-Source
Thank you so much for this amazing tool.
+1 would be great :)
Is there any possibility to hide the TOC in PDFs, until this bug is fixed?
can be "fixed" using:
Hide Chapter Numbers
.section.toc .page {
display: none;
}
Hide TOC
.section.toc {
display: none;
}
@Tiliavir Great ! That hides the table of contents, it'd be best to have gitbook render the page numbers instead too 😄
I've found the problem is not on gitbook itself, but on the default template. As you can see, the structure is title-level. This makes me think I'm not sure if it would be easy (or possible) to get the chapters page numbers because probably this is managed by calibre itself and/or the PDF reader since there are only links and the content can flow (think about long summaries that could extend to several pages...), but doing it in two loops (one to place the pages in position using placeholders for the page numbers, and another one to update the PDF to set the final values) would do the trick...
@piranna I think it's okay for most users to have the render to pdf take some time as long as it contains page numbers in the PDF. It's something most textbooks have and making gitbook have that would be just plain awesome.
I totally agree, GitBook books MUST have page numbers on the index at least in ready-to-print PDFs, and in fact is one of the requeriments of my thesis tutor. My complaints where about complexity to do it, since probably we would need to modify the generated PDF, or generate it twice. Other option would be to generate and replace twice only the summary... Is there any method to get the chapter pages from the generated PDF file? El 24/4/2016 6:23 PM, "Sudheesh Singanamalla" [email protected] escribió:
@piranna https://github.com/piranna I think it's okay for most users to have the render to pdf take some time as long as it contains page numbers in the PDF. It's something most textbooks have and making gitbook have that would be just plain awesome.
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/GitbookIO/gitbook/issues/1223#issuecomment-213996576
There is an option in calibre, that writes a toc at the end of the book ... I've tested it with gitbook, but a TOC at the end was not an option for us, however, this thing has page numbers ...
--pdf-add-toc Add a Table of Contents at the end of the PDF that lists page numbers. Useful if you want to print out the PDF. If this PDF is intended for electronic use, use the PDF Outline instead.
from: https://manual.calibre-ebook.com/generated/en/ebook-convert.html#pdf-output-options
Maybe it is possible to get the required information from here and than to update the TOC at the beginning?
Are you suggesting it's a problem of Calibre? El 26/4/2016 5:40 PM, "Markus Lindenmann" [email protected] escribió:
there is an option in calibre, that writes a toc at the end of the book ... I've tested it with gitbook, but a TOC at the end was not an option for us, however, this thing has page numbers ...
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/GitbookIO/gitbook/issues/1223#issuecomment-214787101
Other option would be, generate the book with this index and later extract it and put at begining... El 26/4/2016 5:47 PM, [email protected] escribió:
Are you suggesting it's a problem of Calibre? El 26/4/2016 5:40 PM, "Markus Lindenmann" [email protected] escribió:
there is an option in calibre, that writes a toc at the end of the book ... I've tested it with gitbook, but a TOC at the end was not an option for us, however, this thing has page numbers ...
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/GitbookIO/gitbook/issues/1223#issuecomment-214787101
Well I fear calibre has kind of the same problem. I think the reason of putting the TOC at the end is just a hack since they know all the page numbers there / at the end of creating the whole document (and my interpretation: they are too lazy or it is too complicated to update / insert a TOC at the beginning).
What I tried to say: maybe it is possible to take the information from the Calibre generated TOC and use it in the own TOC ... This requires two runs and seems very hacky, but since perfomance is not a problem ... and at least it could kind of work ...
Yeah, but besides the proof of concept, I think we should ask Calibre devs about fixing this. El 26/4/2016 6:02 PM, "Markus Lindenmann" [email protected] escribió:
Well I fear calibre has kind of the same problem. I think the reason of putting the TOC at the end is just a hack since they know all the page numbers there (and my interpretation: they are too lazy or it is too complicated to update / insert a TOC at the beginning).
What I tried to say: maybe it is possible to take the information from the Calibre generated TOC and use it in the own TOC ... This requires two runs and seems very hacky, but since perfomance is not a problem ... and at least it could kind of work ...
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/GitbookIO/gitbook/issues/1223#issuecomment-214794423
The best solution will be that Calibre supports CSS printing standard such as counter, footnotes, etc More info.
We could solve the page numbers in the TOC using:
ul.toc a::after {
content: leader('.') target-counter(attr(href), page);
}
But Calibre doesn't support leader and target-counter
The best solution will be that Calibre supports CSS printing standard such as counter, footnotes, etc More info.
Just that page gave me the inspiration to write my thesis using HTML before I knew about GitBook :-P
For those who need to add page numbers right now, I've made a GitBook PDF generator with wkhtmltopdf. See #1470 for a sample.
(I didn't publish an npm yet, so you need to use the code in the sample directly. Remember to do npm install before running the generator. For discussions, go to #1470.)
@SamyPesse : I'm continuing to push a departure from Calibre for PDF generation. Sorry for the push. The requirements for PDF for printing is very different from ebooks, so one product does not fit all.
Any updates on this?
Has anyone found a workaround for that yet?
Not me.. but i’m very interested on having this too. Last time i end up doing it by hand with a pdf editor :(
On 17 Oct 2018, at 14:27, reflectively [email protected] wrote:
Has anyone found a workaround for that yet?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.