datasheet icon indicating copy to clipboard operation
datasheet copied to clipboard

PDF Outline

Open drom opened this issue 5 years ago • 1 comments

Understanding the Difference between Bookmarks and the Outline in a PDF

Creating a Table-of-Contents with PDF.js

https://github.com/mozilla/pdf.js/tree/master/examples/node

CreateOptions, addOutline, insertOutline

Tools

{Adoc, TOC.json} -> [] -> html1

html1 -> [] -> PDF1

PDF1 -> [toc.js] -> TOC.json

  • Parse PDF with pdf.js library https://github.com/mozilla/pdf.js
  • Measure page numbers for Chapters, Sections.
  • Number of pages

{PDF1, TOC.json} -> [] -> PDF2

  • based on printed PDF and TOC.json
  • parse PDF1 using pdf-lib https://github.com/Hopding/pdf-lib
  • add headers and footers. page numbers
  • add Outline using https://github.com/Hopding/pdf-lib/pull/486
  • save modified PDF2

drom avatar Aug 01 '20 22:08 drom

More links

  • https://www.oreilly.com/library/view/pdf-explained/9781449321581/ch04.html
  • https://medium.com/@jberkenbilt/the-structure-of-a-pdf-file-6f08114a58f6
  • https://github.com/lillallol/outline-pdf-cjs

getOutline

drom avatar Apr 22 '25 01:04 drom