11

How can I edit the Table of Contents of a PDF file on Linux? I tried pdfedit but I can't find where the content table list is stored.

2
  • 2
    @new123456: had nothing about ToC editing – koniu Jul 20 '15 at 22:15
  • Perhaps PDFtk can be used to construct an outline (Table of Contents)? See step 3 of superuser.com/a/915399 – Lekensteyn May 29 '16 at 10:03
5

To edit bookmarks in PDF, I recommend the use of PdfMod which is also able to merge and split existing documents, remove, extract or rotate pages.

2
  • But it doesn't edit the table of contents. – Addem Sep 21 '19 at 18:30
  • PdfMod edits PDF own internal table of content and bookmarks... but of course not the "print content" where some text may mention a "Table of contents". – Yves Martin Sep 22 '19 at 20:09
1

A very nice alternative is to use HandyOutliner, which works for PDF and DJVU. It also provides very good functionality for editing the table of contents.

Additionally there is the very handy python script called document-contents-extractor to extract contents from PDF's or DJVU's. It can be installed with pip (for me on Fedora pip3 install --user document-contents-extractor). It requires some additional dependencies to be installed as found in the instructions here.

0

I use two programs, PdfMod and JPdfBookmarks (see also this SourceForge page and the manual).

I found JPdfBookmarks to be superiour: for example, one can easily change the level of a nested bookmark, or exchange two bookmarks, which I was not able to do with the PdfMod.

-8

PDF is an image format. There is no storage of the contents of the table, only a "picture" of it. It can only be edited if the PDF's OCR can read the table as text, which is unlikely. You will need to use another application to create the table and then convert it to PDF.

5
  • 1
    Not true. Check wikipedia en.wikipedia.org/wiki/Portable_Document_Format . What I want is to change the logical structure of the document. – fakedrake Jul 17 '11 at 9:04
  • 4
    PDF is not an image format. It's much more akin to HTML than to something like JPEG. – new123456 Jul 17 '11 at 15:15
  • Sorry. That is incorrect. There is no text or document coding in PDF "documents". The text is "read" by built-in optical character recognition software, just as text is read from any other image. Though it is far more complex in structure than, say, a jpeg, what you are looking at when you open a PDF is an image of a document. They are not really "documents" at all which is why they can't be directly converted to a document format, like .doc. They contain no document format information to convert. – Abraxas Jul 23 '11 at 9:36
  • 1
    Yes, as the article in Wikipedia points out, PDF's are complex. But they describe the way text is rendered, too, and notice that they use the word "drawn", unlike in other documents: "A text element specifies that characters should be drawn at certain positions." – Abraxas Jul 23 '11 at 9:47
  • 1
    This answer and your comment above is very inaccurate. The text is not OCRed, it is actually contained in the PDF file itself. When you open it with a text editor, you can see commands like /Length and stream. Objects with /FlateDecode can then be decompressed using zlib-flate -uncompress which will show text. I could for example recognize "Introduction" in [-1125(In)31(tro)-31(duction)] (generated by pdflatex). – Lekensteyn May 29 '16 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.