agentsclimarketplace

Pdf add bookmarks

Skill StarryCode-Lang/pdf-add-bookmarks

Add hierarchical bookmarks/outline (章→节→小节) to PDF files. Auto-detects text-based vs scanned PDFs, uses OCR for scanned ones. Supports multiple PDF types (textbook/exam/slides/article) with type-specific heading detection. Smart fallback generates candidate TOC when no headings found. Use when user asks to add bookmarks, outline, table of contents, or navigation structure to a PDF. Triggers on: "add bookmarks", "add outline", "为PDF添加书签", "PDF大纲", "PDF目录", "PDF navigation", or providing a PDF path and asking for bookmarks.From its SKILL.md

Install
npx -y skills add StarryCode-Lang/pdf-add-bookmarks

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

4.2 KB, 871 tokens by cl100k_base, as published. Nobody here has run it

PDF Add Bookmarks

Add hierarchical bookmarks (章→节→小节) to PDF files. Supports textbooks, exam papers, slides, and articles with type-specific heading detection. Auto-detects text-based vs scanned PDFs, uses OCR (multiprocessing) for scanned ones.

Quick Start

pip install pymupdf pytesseract pillow
python scripts/add_bookmarks.py "file.pdf"

Output: file_with_bookmarks.pdf

PDF Type Support

TypeDetectionExample Headings
Textbook第X章, X.X, Chapter X第3章 顺序表, 2.1 栈
Exam20XX年真题, 统考, 试题2024年真题应用题
Slides一、, bullet points, short titles一、备考策略
ArticleAbstract, Introduction, References1. Introduction
AutoAll patterns combined

Usage Modes

Auto-detect (default)

Script detects PDF type and uses appropriate heading patterns:

python scripts/add_bookmarks.py "file.pdf"

Analyze Mode

OCR all pages, show content summary, generate a suggested TOC file for review:

python scripts/add_bookmarks.py "file.pdf" --analyze

Output: file_suggested_toc.txt (review/edit then use with --toc)

Auto-generate TOC

OCR all pages, analyze content, generate bookmarks automatically:

python scripts/add_bookmarks.py "file.pdf" --generate-toc

TOC File Mode

Import bookmarks from a text file:

python scripts/add_bookmarks.py "file.pdf" --toc toc.txt [--offset N]

TOC format — one entry per line, indentation for hierarchy:

第1章 概述 1
  1.1 背景 2
    1.1.1 研究现状 3
  1.2 目标 10
第2章 方法 15

Force OCR

python scripts/add_bookmarks.py "file.pdf" --force-ocr

All Options

usage: add_bookmarks.py [-h] [-o OUTPUT] [--lang LANG] [--force-ocr]
                        [--toc TOC] [--offset OFFSET] [--workers WORKERS]
                        [--analyze] [--generate-toc]
                        [--type {auto,textbook,exam,slides,article}]
                        input

positional arguments:
  input                 Input PDF file path

options:
  -o, --output          Output PDF path (default: *_with_bookmarks.pdf)
  --lang LANG           Tesseract OCR language (default: chi_sim+eng)
  --force-ocr           Force OCR mode
  --toc TOC             TOC text file path (title+page per line)
  --offset OFFSET       Page offset for TOC mode
  --workers WORKERS     Number of OCR worker processes
  --analyze             Analyze PDF: OCR all pages, show content summary,
                        generate suggested TOC file
  --generate-toc        Auto-generate TOC by OCR+analyzing all pages,
                        then add bookmarks
  --type                PDF type hint (auto/textbook/exam/slides/article)

Dependencies

See references/dependencies.md for cross-platform tesseract + Chinese language data setup.

Required: pymupdf pytesseract pillow + tesseract-ocr system tool.

Multi-Agent Installation

See install/INDEX.md for installation guides for:

  • Claude Code — Plugin with /pdf-add-bookmarks command
  • OpenCode — Agent/skill definition
  • Hermes — Skill with SKILL.md
  • OpenClaw — Skill config
  • Kimi Code — Plugin config
  • Other agents — Manual script usage

What ships with it: 23 files

83.5 KB alongside SKILL.md, 6 of them executable

references/

scripts/

Keep looking

Skills are one crate of 326,144. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.