How to Enable Technical Mode for PDF Extraction in book-to-skill
Enable technical mode by passing --mode technical to scripts/extract.py to switch from plain-text extraction to Docling's layout-aware parser that preserves tables, code blocks, and complex formatting.
The book-to-skill repository provides a dual-pipeline PDF extraction system designed to handle both narrative books and complex technical documents. By default, the tool uses a lightweight text extractor, but technical mode activates Docling—a specialized backend that understands document structure. This guide walks through exactly how to enable and use this feature based on the current source code implementation.
What Technical Mode Does
book-to-skill offers two extraction modes controlled by the same CLI flag:
| Mode | Pipeline | Best For |
|---|---|---|
| text (default) | pdftotext chain |
Fiction, narrative prose, simple layouts |
| technical | Docling | Manuals, textbooks, code snippets, formulas, multi-column layouts |
In book_to_skill/parsers/pdf.py, the extraction logic branches based on the extraction_mode parameter. When set to "technical", the parser initializes Docling's layout-aware engine instead of falling back to plain-text conversion. The docstring in that file explicitly notes this mode is "Best for technical books" containing structured elements.
Where the Mode Is Configured
The mode configuration flows through three key files:
book_to_skill/utils.py(lines 75-78): Defines the default value"text"and parses user overrides (lines 84-86)scripts/extract.py: CLI entry point that passes the mode to the extraction pipelinebook_to_skill/parsers/pdf.py: Executes the actual mode selection at runtime
The parse_arguments() function in utils.py also prints a banner confirming your selection: Mode: technical — using Docling …
Enable Technical Mode via CLI
Add the --mode technical flag to any extraction command:
# Default text extraction
python scripts/extract.py my_book.pdf
# Enable technical mode for complex documents
python scripts/extract.py my_tech_manual.pdf --mode technical
Skip Dependency Installation Prompts
Docling is an optional dependency declared in book_to_skill/dependencies.py. If already installed, suppress automatic installation checks:
python scripts/extract.py manual.pdf --mode technical --install-missing no
Enable Technical Mode Programmatically
Import parse_arguments directly to configure mode in Python code:
from book_to_skill.utils import parse_arguments
# Simulate CLI arguments
argv = ["extract.py", "technical_manual.pdf", "--mode", "technical"]
input_paths, mode, install = parse_arguments(argv)
# mode == "technical" — pass to PDF parser
print(f"Extraction mode: {mode}")
This returns the parsed mode string that you would pass to the PDF parser class in book_to_skill/parsers/pdf.py.
Dependency Requirements
Technical mode requires the docling package. The extraction pipeline handles missing dependencies in two ways:
- Default behavior: Prompts for automatic installation when Docling is not found
- With
--install-missing no: Skips prompts; fails immediately ifdoclingis absent
Install manually ahead of time to avoid interruptions:
pip install docling
Summary
- Use
--mode technicalto activate Docling's layout-aware PDF extraction - Default mode is
"text"usingpdftotextfor simple documents - Three files control the flow:
utils.pyfor parsing,extract.pyfor CLI,pdf.pyfor execution - Docling is optional—install separately or allow automatic prompts
Frequently Asked Questions
What types of PDFs benefit most from technical mode?
Technical PDFs containing tables, code blocks, mathematical formulas, or multi-column layouts. Docling preserves structural relationships that pdftotext flattens into unstructured text.
Where is the default extraction mode defined?
In book_to_skill/utils.py at lines 75-78, where the argument parser sets default="text" for the --mode parameter.
What happens if Docling is not installed when I use technical mode?
By default, the system prompts you to install missing dependencies. Pass --install-missing no to disable this behavior and receive an immediate error instead.
Can I switch modes without modifying code?
Yes—technical mode is fully controlled by the CLI flag. No configuration files or environment variables are required; simply add or remove --mode technical from your command.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →