Well, you could always buy a copy of Adobe Acrobat, which is actually designed solely for the purpose of creating and editing PDF files.
Or you could import the file into Calibre, convert it to ePub format, edit the ePub to add the table of contents, then convert it back to PDF.
There are other free tools for working with PDF directly. If you do a Google ...
I will extend on @Donald's answer but I would also like to note I do not recommend, personally for quality issues, ever using Calibre for ebook development.
As stated I would suggest getting a copy of Acrobat and you can (for this example I am using Acrobat X Standard but note the I have not seen any difference in the shortcut buttons BUT the GUI has ...
There are also free tools that allow editing/adding bookmarks. A cross platform example is jPdf Tweak.
It is a little clumsy to use, but you can create the table of contents in your favourite spreadsheet program, export as csv and then just import it.
Both Sigil and Calibre can edit or create a TOC for .epub books.
In Sigil, once you have opened your ebook, press Ctrl+T
, and you will open a window where you can generate the TOC from the various h1, h2, h3 (and so on) tags, you can manually select how deep to go in the header hierarchy.
Inside Calibre, select the ebook, press K, and you will get another ...
Probably the best approach for this would be to treat each category as a chapter. The whole point of chapters in a book is to control the order in which a reader proceeds through the book. It sounds like you want to ensure that each category is read in a specific order, so your next step would be to decide just what that order should be.
If you still want ...
First, we need to define our terms more precisely.
EPUB 2 uses the toc.ncx file to produce a machine-processed table of contents. It is not human readable but automatically appears in most ebook reading platforms.
EPUB 3 allows the use of toc.ncx (for back compatibility reasons) but also allows a (human readable) "navigation document", which is an HTML5 ...
k2pdfopt (free, open source) can also do this by supplying a text file. See the -toclist option. Use like so:
k2pdfopt -mode copy -n -toclist my_chapter_list.txt srcfile.pdf -o outfile.pdf
...where my_chapter_list.txt is a simple ASCII file with page numbers beginning each line, e.g.
2 Table of Contents
5 Chapter 1
25 Chapter 2
Since the CBZ format is not standardised, there are some pitfalls if you try to achieve this.
The best you can do is render the ToC as an image and add it at the front of list of image files contained in the CBZ.
Adding an extra file with the ToC information might break existing readers, if that ToC is not an image file.
An alternative is to load the data ...
I am used to a simple and free tool that adds clickable bookmarks to PDF or DjVU files: http://handyoutlinerfo.sourceforge.net/.
You first have to prepare (and import in the tool) bookmarks entered in a text file as an indented list of labels and pages. Then the tool creates them in the document as bookmarks you can open/reduce and click on using the left ...
Define what is: "fix it at the first place".
If you want to fix wrong output from OCR analysis, a simple solution on an infinite set of TOCs you will never make.
You will never apply all variations. You would have to create a machine learning algorithm that would analyze each TOC variant.
Or count substrings of the same characteristics (in simple TOC).
If your book isn't DRM-protected or you manage to DeDRM it, you could convert it to an epub book with Calibre, regenerate the TOC from all headings and convert it back to an azw3 or kfx book. (If the original book is an azw3 book you could also directly edit it with Calibre Editor.)
Obviously, this method will only work if all headings were marked with h1.....
You're looking at the problem backwards.
My admittedly complex solution is to code in Docbook XML, and then the XML to XHTML transformation autogenerates the TOC with correct title. (Docbook XSLT autogenerates the epub nav document and all related material).
With most tools the nav.xhtml file is autogenerated by whatever is H1 in the particular chapter.
The Amazon Publishing Guidelines has sample code for making a nested html TOC.
It's on page 16
<div style="margin-left:2%;">Chapter 1</div>
<div style="margin-left:2%;">Chapter 2</div>
<div style="margin-left:2%;">Chapter 3</div>
<div style="margin-left:4%;">Subchapter 1</div&...
I'll post an answer which seems to be working for me.
I found relevant documentation here: http://www.idpf.org/epub/30/spec/epub30-publications.html#sec-package-documents
Using Ruby and Nokogiri, I decompressed the ePub file, read the package document as HTML, then used an XPath statement:
unzipped_file = Zip::File.open(epub_file)
package_file = ...
I'm guessing that you are asking the question in the wrong way: you actually want to hide the HTML entries from the TOC so that the TOC doesn't spoil any surprises. I have good news. In epub3 you can create a navigation page and hide all the entries in that TOC.
Let me explain some basics. The terminology can be confusing because initially Kindle required ...
Just a suggestion but you could try:
Outputting your DOCX format to html from within MS-Word,
Making sure that it all works including the ToC, when it is in HTML format, preferably using more than one browser, and then
Converting the HTML format to MOBI from within Calibre -
This will save Calibre from having to deal with 2 formats at once, (DOCX & ...
Calibre editor has a graphical interface that lets you edit the ToC of a given ebook file (the ToC editor itself is accesible also from the default window, without the need to open the full editor).
You can select different ways to create the ToC, I think that in your case you should experiment by selecting "major headings" or "all headings".
@Morne's answer is correct; you cannot totally disable the NCX file but of course you don't have to put anything (or very much) in it.
However, another option might be to build an ePub 3 file - the NCX is optional in ePub 3, so you could just omit it.
That said, I do not know how existing readers render ePubs which do not contain an NCX.
You cannot deactivate/remove the ncx file. As the epub will not validate without it. Why dont you just simply remove all the links from within it, that way, if a reader does open it up in a sidebar it will simply show a blank screen. Not really user friendly though. I would recommend you add atleast one entry, pointing to the start of your book or your "...
Jpdfbookmark can work for scanned books
Prepare the TOC in .txt file
Chapter 1. The Beginning/23
Para 1.1 Child of The Beginning/25,FitWidth,96
Para 1.1.1 Child of Child of The Beginning/26,FitHeight,43
Chapter 2. The Continue/30,TopLeft,120,42
Para 2.1 Child of The Beginning/32,FitPage
You can OCR the TOC and use regex to fix it.